Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: Remove deprecated fields #200

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 1 addition & 2 deletions lib/lago/api/resources/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ def whitelist_params(params)
billing_time: params[:billing_time],
subscription_at: params[:subscription_at],
ending_at: params[:ending_at],
subscription_date: params[:subscription_date], # Deprecated
plan_overrides: params[:plan_overrides],
}.compact
}.compact,
}
end
end
Expand Down
9 changes: 0 additions & 9 deletions spec/factories/group.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/factories/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
billing_time { 'calendar' }
started_at { '2022-05-05T12:27:30Z' }
ending_at { '2022-08-05T00:00:00Z' }
subscription_date { '2022-05-05' }
subscription_at { '2022-05-05T12:27:30Z' }
terminated_at { nil }
canceled_at { nil }
created_at { '2022-05-05T12:27:30Z' }
Expand Down
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
6 changes: 3 additions & 3 deletions spec/fixtures/api/invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"status": "active",
"billing_time": "anniversary",
"terminated_at": null,
"subscription_date": "2022-04-29",
"subscription_at": "2022-04-29T12:27:30Z",
"previous_plan_code": null,
"next_plan_code": null,
"downgrade_plan_date": null
Expand Down Expand Up @@ -140,9 +140,9 @@
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": 10,
"amount_currency": "EUR",
"before_vat": true,
"before_taxes": true,
"item": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_item_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"type": "coupon",
"code": "free_beer",
"name": "Free Beer"
Expand Down
5 changes: 3 additions & 2 deletions spec/fixtures/api/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"name": "Hooli",
"created_at": "2022-05-02T13:04:09Z",
"webhook_url": "https://test-example.example",
"webhook_urls": ["https://test-example.example"],
"webhook_urls": [
"https://test-example.example"
],
"country": null,
"default_currency": "USD",
"address_line1": null,
Expand All @@ -22,7 +24,6 @@
"billing_configuration": {
"invoice_footer": null,
"invoice_grace_period": 3,
"vat_rate": 15.0,
"document_locale": "fr"
},
"taxes": [
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.

Loading
Loading