chartmogul-ruby 1.6.8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +44 -0
- data/2.0-Upgrade.md +9 -0
- data/README.md +8 -2
- data/changelog.md +15 -1
- data/chartmogul-ruby.gemspec +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_in_a_threaded_environment.yml +3 -3
- data/fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_when_credentials_are_updated.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Account/returns_details_of_current_account.yml +64 -0
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_custom_attributes.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_required_tags.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/can_page_through_search_endpoint.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_handles_a_422_response.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_interracts_with_the_API.yml +72 -124
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/merges_customers.yml +5 -5
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_401_if_invalid_credentials.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_404_if_no_customers_found.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_422_for_update_with_invalid_data.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/removes_custom_attributes.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/removes_tags.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/respects_camel_case_for_all_customers_endpoint.yml +45 -0
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_all_customers_through_list_all_endpoint.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_customer_through_retrieve_endpoint.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_right_customers_through_search_endpoint.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_custom_attributes.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_customer.yml +3 -3
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_customer_using_class_method.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Customer/_find_by_external_id/when_external_id_is_provided/returns_matching_user_if_exists.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Customer/_find_by_external_id/when_external_id_is_provided/returns_nil_if_customer_does_not_exist.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_CustomerInvoices/API_Interactions/correctly_interracts_with_the_API.yml +7 -7
- data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_interracts_with_the_API.yml +4 -4
- data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_404.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_422.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/retrieves_existing_data_source_matching_uuid.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/deletes_an_invoice.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/deletes_an_invoice_with_class_method.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/raises_error_on_deleting_non-existing_invoice.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/retrieves_existing_invoice_by_uuid.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/returns_all_invoices_through_list_all_endpoint.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARPA/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARPA/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity.yml +37 -0
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/behaves_like_PageableWithAnchor/should_be_pageable.yml +44 -0
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/should_have_Activity_entries.yml +18 -15
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_AllKeyMetric/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Activity → ChartMogul_Metrics_Customers_Activity}/behaves_like_Pageable/should_be_pageable.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Customers_Activity/should_have_Activity_entries.yml +41 -0
- data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Subscription → ChartMogul_Metrics_Customers_Subscription}/behaves_like_Pageable/should_be_pageable.yml +1 -1
- data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Subscription → ChartMogul_Metrics_Customers_Subscription}/should_have_Subscription_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/behaves_like_Summary/should_have_summary.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_on_incorrect_credentials.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_with_500_internal_server_error.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_with_504_gateway_timeout_error.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/when_credentials_correct.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/correctly_handles_a_422_error.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/correctly_interacts_with_the_API.yml +3 -3
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/deletes_existing_plan.yml +4 -4
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/retrieves_existing_plan_by_uuid.yml +3 -3
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/updates_existing_plan.yml +4 -4
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/updates_existing_plan_using_class_method.yml +3 -3
- data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/correctly_handles_a_422_error.yml +1 -1
- data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/deletes_a_plan_group.yml +6 -6
- data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/retrieves_existing_plan_group_by_uuid.yml +5 -5
- data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/returns_an_array_of_plan_groups.yml +7 -7
- data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/updates_existing_plan_group_name.yml +6 -6
- data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/updates_existing_plan_group_name_via_class_method.yml +5 -5
- data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/updates_existing_plan_group_plans.yml +8 -8
- data/fixtures/vcr_cassettes/ChartMogul_PlanGroups_Plans/API_interactions/given_a_plan_group_uuid_returns_an_array_of_plans_in_the_plan_group.yml +5 -5
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/API_Interactions/connects_subscriptions.yml +10 -10
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/API_Interactions/correctly_interracts_with_the_API.yml +7 -7
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/API_Interactions/has_multiple_aliases.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/_update_cancellation_dates/when_array_has_time_objects/is_setting_the_cancellation_dates_of_the_subscription.yml +3 -3
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/_update_cancellation_dates/when_array_includes_invalid_entries/raises_an_exception.yml +2 -2
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/_update_cancellation_dates/when_array_includes_valid_entries/is_setting_the_cancellation_dates_of_the_subscription.yml +3 -3
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/_update_cancellation_dates/when_array_is_empty/makes_an_API_call_and_removes_the_cancellation_dates.yml +3 -3
- data/fixtures/vcr_cassettes/ChartMogul_Transactions_Payment/API_Interactions/correctly_interracts_with_the_API.yml +5 -5
- data/lib/chartmogul.rb +10 -3
- data/lib/chartmogul/account.rb +19 -0
- data/lib/chartmogul/api/actions/all.rb +2 -1
- data/lib/chartmogul/api/actions/create.rb +2 -2
- data/lib/chartmogul/api/actions/custom.rb +1 -1
- data/lib/chartmogul/api/actions/retrieve.rb +2 -1
- data/lib/chartmogul/api/actions/update.rb +2 -2
- data/lib/chartmogul/api_resource.rb +8 -4
- data/lib/chartmogul/concerns/pageable_with_anchor.rb +14 -0
- data/lib/chartmogul/config_attributes.rb +17 -1
- data/lib/chartmogul/customer.rb +2 -1
- data/lib/chartmogul/metrics/activity.rb +12 -8
- data/lib/chartmogul/metrics/customers/activity.rb +38 -0
- data/lib/chartmogul/metrics/customers/subscription.rb +41 -0
- data/lib/chartmogul/transactions/payment.rb +1 -1
- data/lib/chartmogul/transactions/refund.rb +1 -1
- data/lib/chartmogul/utils/hash_snake_caser.rb +9 -2
- data/lib/chartmogul/utils/json_parser.rb +2 -4
- data/lib/chartmogul/version.rb +1 -1
- metadata +18 -10
- data/.DS_Store +0 -0
- data/.travis.yml +0 -25
- data/lib/chartmogul/metrics/subscription.rb +0 -39
data/.DS_Store
DELETED
Binary file
|
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
os: linux
|
2
|
-
dist: bionic
|
3
|
-
|
4
|
-
language: ruby
|
5
|
-
|
6
|
-
rvm:
|
7
|
-
- 2.3
|
8
|
-
- 2.4
|
9
|
-
- 2.5
|
10
|
-
- 2.6
|
11
|
-
- 2.7
|
12
|
-
|
13
|
-
before_install: gem install bundler
|
14
|
-
|
15
|
-
before_script:
|
16
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
17
|
-
- chmod +x ./cc-test-reporter
|
18
|
-
- ./cc-test-reporter before-build
|
19
|
-
|
20
|
-
branches:
|
21
|
-
only:
|
22
|
-
- main
|
23
|
-
|
24
|
-
after_script:
|
25
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ChartMogul
|
4
|
-
module Metrics
|
5
|
-
class Subscription < ChartMogul::Object
|
6
|
-
readonly_attr :id
|
7
|
-
readonly_attr :external_id
|
8
|
-
readonly_attr :plan
|
9
|
-
readonly_attr :quantity
|
10
|
-
readonly_attr :mrr
|
11
|
-
readonly_attr :arr
|
12
|
-
readonly_attr :status
|
13
|
-
readonly_attr :billing_cycle
|
14
|
-
readonly_attr :billing_cycle_count
|
15
|
-
readonly_attr :start_date, type: :time
|
16
|
-
readonly_attr :end_date, type: :time
|
17
|
-
readonly_attr :currency
|
18
|
-
readonly_attr :currency_sign
|
19
|
-
|
20
|
-
def self.all(customer_uuid, options = {})
|
21
|
-
ChartMogul::Metrics::Subscriptions.all(customer_uuid, options)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class Subscriptions < APIResource
|
26
|
-
set_resource_name 'Subscriptions'
|
27
|
-
set_resource_path '/v1/customers/:customer_uuid/subscriptions'
|
28
|
-
|
29
|
-
include Concerns::Entries
|
30
|
-
include Concerns::Pageable
|
31
|
-
|
32
|
-
set_entry_class Subscription
|
33
|
-
|
34
|
-
def self.all(customer_uuid, options = {})
|
35
|
-
super(options.merge(customer_uuid: customer_uuid))
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|