Skip to content

Commit

Permalink
misc: Remove deprecated fields
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-pochet committed Jul 9, 2024
1 parent cb94098 commit 4004da1
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 147 deletions.
1 change: 0 additions & 1 deletion lib/lago-ruby-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
require 'lago/api/resources/event'
require 'lago/api/resources/fee'
require 'lago/api/resources/gross_revenue'
require 'lago/api/resources/group'
require 'lago/api/resources/invoice'
require 'lago/api/resources/invoice_collection'
require 'lago/api/resources/invoiced_usage'
Expand Down
4 changes: 0 additions & 4 deletions lib/lago/api/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ def fees
Lago::Api::Resources::Fee.new(self)
end

def groups
Lago::Api::Resources::Group.new(self)
end

def applied_coupons
Lago::Api::Resources::AppliedCoupon.new(self)
end
Expand Down
1 change: 0 additions & 1 deletion lib/lago/api/resources/billable_metric.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def whitelist_params(params)
aggregation_type: params[:aggregation_type],
weighted_interval: params[:weighted_interval],
field_name: params[:field_name],
group: params[:group],
filters: params[:filters],
}.compact,
}
Expand Down
24 changes: 0 additions & 24 deletions lib/lago/api/resources/group.rb

This file was deleted.

1 change: 0 additions & 1 deletion lib/lago/api/resources/plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def whitelist_charges(charges)
:invoice_display_name,
:min_amount_cents,
:properties,
:group_properties,
:filters,
:tax_codes,
)
Expand Down
9 changes: 0 additions & 9 deletions spec/factories/group.rb

This file was deleted.

8 changes: 0 additions & 8 deletions spec/fixtures/api/billable_metric.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
"recurring": false,
"field_name": "amount_sum",
"created_at": "2022-04-29T08:59:51Z",
"group": {
"key": "country",
"values": [
"france",
"italy",
"spain"
]
},
"filters": [
{
"key": "country",
Expand Down
2 changes: 0 additions & 2 deletions spec/fixtures/api/billable_metric_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"recurring": false,
"field_name": "amount_sum",
"created_at": "2022-04-29T08:59:51Z",
"group": {},
"filters": [],
"active_subscriptions_count": 0,
"draft_invoices_count": 0,
Expand All @@ -26,7 +25,6 @@
"recurring": false,
"field_name": "amount_sum",
"created_at": "2022-04-30T08:59:51Z",
"group": {},
"filters": [],
"active_subscriptions_count": 0,
"draft_invoices_count": 0,
Expand Down
1 change: 0 additions & 1 deletion spec/fixtures/api/customer_past_usage.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"code": "usage_metric",
"aggregation_type": "sum"
},
"groups": [],
"filters": [
{
"units": "3.0",
Expand Down
20 changes: 0 additions & 20 deletions spec/fixtures/api/customer_usage.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@
"code": "usage_metric",
"aggregation_type": "sum"
},
"groups": [
{
"lago_id": "12435687-1de8-4428-9bcd-779314ac1111",
"key": "google",
"value": "europe",
"units": "3.0",
"events_count": 1,
"amount_cents": 123
}
],
"filters": [
{
"units": "3.0",
Expand All @@ -55,16 +45,6 @@
"grouped_by": {
"agent_name": "aragorn"
},
"groups": [
{
"lago_id": "12435687-1de8-4428-9bcd-779314ac1111",
"key": "google",
"value": "europe",
"units": "3.0",
"events_count": 1,
"amount_cents": 123
}
],
"filters": [
{
"units": "3.0",
Expand Down
1 change: 0 additions & 1 deletion spec/fixtures/api/fee.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"fee": {
"lago_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"lago_group_id": "1a2d9c8d-5875-4688-9854-5ccfd414bc5e",
"lago_charge_filter_id": "1a2d9c8d-5875-4688-9854-5ccfd414bc5e",
"lago_invoice_id": "1a2d9c8d-5875-4688-9854-5ccfd414bc5e",
"lago_true_up_fee_id": "1a2d9c8d-5875-4688-9854-5ccfd414bc5e",
Expand Down
9 changes: 0 additions & 9 deletions spec/fixtures/api/plans.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@
"agent_name"
]
},
"group_properties": [
{
"group_id": "gfc1e851-5be6-4343-a0ee-39a81d8b4ee1",
"values": {
"amount": "0.22"
},
"invoice_display_name": "Europe"
}
],
"filters": [
{
"invoice_display_name": "From France",
Expand Down
26 changes: 13 additions & 13 deletions spec/lago/api/resources/applied_coupon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
{
'status' => 422,
'error' => 'Unprocessable Entity',
'message' => 'Validation error on the record'
'message' => 'Validation error on the record',
}.to_json
end

describe '#create' do
let(:params) { factory_applied_coupon.to_h }
let(:body) do
{
'applied_coupon' => factory_applied_coupon.to_h
'applied_coupon' => factory_applied_coupon.to_h,
}
end

Expand All @@ -34,10 +34,10 @@
'frequency' => factory_applied_coupon.frequency,
'amount_cents' => 123,
'amount_currency' => 'EUR',
'expiration_date' => '2022-04-29',
'expiration_at' => '2022-04-29T08:59:51Z',
'created_at' => '2022-04-29T08:59:51Z',
'terminated_at' => '2022-04-29T08:59:51Z'
}
'terminated_at' => '2022-04-29T08:59:51Z',
},
}.to_json
end

Expand Down Expand Up @@ -83,18 +83,18 @@
'amount_currency' => 'EUR',
'frequency_duration' => 3,
'frequency_duration_remaining' => 1,
'expiration_date' => '2022-04-29',
'expiration_at' => '2022-04-29T08:59:51Z',
'created_at' => '2022-04-29T08:59:51Z',
'terminated_at' => '2022-04-29T08:59:51Z'
}
'terminated_at' => '2022-04-29T08:59:51Z',
},
],
'meta': {
'current_page' => 1,
'next_page' => 2,
'prev_page' => nil,
'total_pages' => 7,
'total_count' => 63
}
'total_count' => 63,
},
}.to_json
end

Expand Down Expand Up @@ -152,10 +152,10 @@
'frequency' => factory_applied_coupon.frequency,
'amount_cents' => 123,
'amount_currency' => 'EUR',
'expiration_date' => '2022-04-29',
'expiration_at' => '2022-04-29T08:59:51Z',
'created_at' => '2022-04-29T08:59:51Z',
'terminated_at' => '2022-04-29T08:59:51Z'
}
'terminated_at' => '2022-04-29T08:59:51Z',
},
}.to_json
end

Expand Down
6 changes: 3 additions & 3 deletions spec/lago/api/resources/billable_metric_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
end

describe '#create' do
let(:group) do
let(:filters) do
{
key: 'country',
values: %w[france italy spain],
}
end

let(:params) { create(:create_billable_metric).to_h.merge(group: group) }
let(:params) { create(:create_billable_metric).to_h.merge(filters: [filters.to_h]) }

context 'when billable metric is successfully created' do
before do
Expand All @@ -40,7 +40,7 @@

expect(billable_metric.lago_id).to eq('b7ab2926-1de8-4428-9bcd-779314ac129b')
expect(billable_metric.name).to eq('bm_name')
expect(billable_metric.group.to_h).to eq(group)
expect(billable_metric.filters.map(&:to_h)).to eq([filters.to_h])
expect(billable_metric.weighted_interval).to be_nil
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lago/api/resources/fee_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
let(:fee_id) { fee_json['lago_id'] }
let(:fee_invoice_display_name) { fee_json['invoice_display_name'] }
let(:fee_item_invoice_display_name) { fee_json['item']['invoice_display_name'] }
let(:fee_item_group_invoice_display_name) { fee_json['item']['group_invoice_display_name'] }
let(:fee_item_filter_invoice_display_name) { fee_json['item']['filter_invoice_display_name'] }

let(:error_response) do
{
Expand All @@ -35,7 +35,7 @@
expect(fee.lago_id).to eq(fee_id)
expect(fee.invoice_display_name).to eq(fee_invoice_display_name)
expect(fee.item.invoice_display_name).to eq(fee_item_invoice_display_name)
expect(fee.item.group_invoice_display_name).to eq(fee_item_group_invoice_display_name)
expect(fee.item.filter_invoice_display_name).to eq(fee_item_filter_invoice_display_name)
end
end

Expand Down
47 changes: 0 additions & 47 deletions spec/lago/api/resources/group_spec.rb

This file was deleted.

1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
require 'lago/api/resources/event'
require 'lago/api/resources/fee'
require 'lago/api/resources/gross_revenue'
require 'lago/api/resources/group'
require 'lago/api/resources/invoice'
require 'lago/api/resources/invoice_collection'
require 'lago/api/resources/invoiced_usage'
Expand Down

0 comments on commit 4004da1

Please sign in to comment.