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.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +44 -0
  3. data/2.0-Upgrade.md +9 -0
  4. data/README.md +8 -2
  5. data/changelog.md +15 -1
  6. data/chartmogul-ruby.gemspec +1 -1
  7. data/fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_in_a_threaded_environment.yml +3 -3
  8. data/fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_when_credentials_are_updated.yml +2 -2
  9. data/fixtures/vcr_cassettes/ChartMogul_Account/returns_details_of_current_account.yml +64 -0
  10. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_custom_attributes.yml +2 -2
  11. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_required_tags.yml +2 -2
  12. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/can_page_through_search_endpoint.yml +1 -1
  13. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_handles_a_422_response.yml +1 -1
  14. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_interracts_with_the_API.yml +72 -124
  15. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/merges_customers.yml +5 -5
  16. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_401_if_invalid_credentials.yml +1 -1
  17. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_404_if_no_customers_found.yml +1 -1
  18. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_422_for_update_with_invalid_data.yml +2 -2
  19. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/removes_custom_attributes.yml +2 -2
  20. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/removes_tags.yml +2 -2
  21. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/respects_camel_case_for_all_customers_endpoint.yml +45 -0
  22. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_all_customers_through_list_all_endpoint.yml +1 -1
  23. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_customer_through_retrieve_endpoint.yml +1 -1
  24. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_right_customers_through_search_endpoint.yml +1 -1
  25. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_custom_attributes.yml +2 -2
  26. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_customer.yml +3 -3
  27. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_customer_using_class_method.yml +1 -1
  28. data/fixtures/vcr_cassettes/ChartMogul_Customer/_find_by_external_id/when_external_id_is_provided/returns_matching_user_if_exists.yml +2 -2
  29. 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
  30. data/fixtures/vcr_cassettes/ChartMogul_CustomerInvoices/API_Interactions/correctly_interracts_with_the_API.yml +7 -7
  31. data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_interracts_with_the_API.yml +4 -4
  32. data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_404.yml +1 -1
  33. data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_422.yml +1 -1
  34. data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/retrieves_existing_data_source_matching_uuid.yml +2 -2
  35. data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/deletes_an_invoice.yml +1 -1
  36. data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/deletes_an_invoice_with_class_method.yml +1 -1
  37. data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/raises_error_on_deleting_non-existing_invoice.yml +1 -1
  38. data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/retrieves_existing_invoice_by_uuid.yml +1 -1
  39. data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/returns_all_invoices_through_list_all_endpoint.yml +1 -1
  40. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARPA/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
  41. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARPA/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
  42. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
  43. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
  44. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
  45. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
  46. data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity.yml +37 -0
  47. data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/behaves_like_PageableWithAnchor/should_be_pageable.yml +44 -0
  48. data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/should_have_Activity_entries.yml +18 -15
  49. data/fixtures/vcr_cassettes/ChartMogul_Metrics_AllKeyMetric/should_have_entries.yml +1 -1
  50. data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
  51. data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
  52. data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
  53. data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
  54. data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Activity → ChartMogul_Metrics_Customers_Activity}/behaves_like_Pageable/should_be_pageable.yml +1 -1
  55. data/fixtures/vcr_cassettes/ChartMogul_Metrics_Customers_Activity/should_have_Activity_entries.yml +41 -0
  56. data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Subscription → ChartMogul_Metrics_Customers_Subscription}/behaves_like_Pageable/should_be_pageable.yml +1 -1
  57. data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Subscription → ChartMogul_Metrics_Customers_Subscription}/should_have_Subscription_entries.yml +1 -1
  58. data/fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
  59. data/fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
  60. data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/behaves_like_Summary/should_have_summary.yml +1 -1
  61. data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/should_have_entries.yml +1 -1
  62. data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +1 -1
  63. data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +1 -1
  64. data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_on_incorrect_credentials.yml +1 -1
  65. data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_with_500_internal_server_error.yml +1 -1
  66. data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_with_504_gateway_timeout_error.yml +1 -1
  67. data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/when_credentials_correct.yml +1 -1
  68. data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/correctly_handles_a_422_error.yml +1 -1
  69. data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/correctly_interacts_with_the_API.yml +3 -3
  70. data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/deletes_existing_plan.yml +4 -4
  71. data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/retrieves_existing_plan_by_uuid.yml +3 -3
  72. data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/updates_existing_plan.yml +4 -4
  73. data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/updates_existing_plan_using_class_method.yml +3 -3
  74. data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/correctly_handles_a_422_error.yml +1 -1
  75. data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/deletes_a_plan_group.yml +6 -6
  76. data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/retrieves_existing_plan_group_by_uuid.yml +5 -5
  77. data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/returns_an_array_of_plan_groups.yml +7 -7
  78. data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/updates_existing_plan_group_name.yml +6 -6
  79. data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/updates_existing_plan_group_name_via_class_method.yml +5 -5
  80. data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/updates_existing_plan_group_plans.yml +8 -8
  81. 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
  82. data/fixtures/vcr_cassettes/ChartMogul_Subscription/API_Interactions/connects_subscriptions.yml +10 -10
  83. data/fixtures/vcr_cassettes/ChartMogul_Subscription/API_Interactions/correctly_interracts_with_the_API.yml +7 -7
  84. data/fixtures/vcr_cassettes/ChartMogul_Subscription/API_Interactions/has_multiple_aliases.yml +2 -2
  85. 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
  86. data/fixtures/vcr_cassettes/ChartMogul_Subscription/_update_cancellation_dates/when_array_includes_invalid_entries/raises_an_exception.yml +2 -2
  87. 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
  88. 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
  89. data/fixtures/vcr_cassettes/ChartMogul_Transactions_Payment/API_Interactions/correctly_interracts_with_the_API.yml +5 -5
  90. data/lib/chartmogul.rb +10 -3
  91. data/lib/chartmogul/account.rb +19 -0
  92. data/lib/chartmogul/api/actions/all.rb +2 -1
  93. data/lib/chartmogul/api/actions/create.rb +2 -2
  94. data/lib/chartmogul/api/actions/custom.rb +1 -1
  95. data/lib/chartmogul/api/actions/retrieve.rb +2 -1
  96. data/lib/chartmogul/api/actions/update.rb +2 -2
  97. data/lib/chartmogul/api_resource.rb +8 -4
  98. data/lib/chartmogul/concerns/pageable_with_anchor.rb +14 -0
  99. data/lib/chartmogul/config_attributes.rb +17 -1
  100. data/lib/chartmogul/customer.rb +2 -1
  101. data/lib/chartmogul/metrics/activity.rb +12 -8
  102. data/lib/chartmogul/metrics/customers/activity.rb +38 -0
  103. data/lib/chartmogul/metrics/customers/subscription.rb +41 -0
  104. data/lib/chartmogul/transactions/payment.rb +1 -1
  105. data/lib/chartmogul/transactions/refund.rb +1 -1
  106. data/lib/chartmogul/utils/hash_snake_caser.rb +9 -2
  107. data/lib/chartmogul/utils/json_parser.rb +2 -4
  108. data/lib/chartmogul/version.rb +1 -1
  109. metadata +18 -10
  110. data/.DS_Store +0 -0
  111. data/.travis.yml +0 -25
  112. data/lib/chartmogul/metrics/subscription.rb +0 -39
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic OGIzNjcyOWUzMmU1OWJiMTBlNjEwZWZiOWFhNjExZTA6Nzg0MWEyNWU4Y2VkMmZjOGRmYzFhZGU3YWM0ZmFjZTQ=
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 201
@@ -50,7 +50,7 @@ http_interactions:
50
50
  Content-Type:
51
51
  - application/json
52
52
  Authorization:
53
- - Basic OGIzNjcyOWUzMmU1OWJiMTBlNjEwZWZiOWFhNjExZTA6Nzg0MWEyNWU4Y2VkMmZjOGRmYzFhZGU3YWM0ZmFjZTQ=
53
+ - Basic hidden
54
54
  response:
55
55
  status:
56
56
  code: 201
@@ -102,7 +102,7 @@ http_interactions:
102
102
  Content-Type:
103
103
  - application/json
104
104
  Authorization:
105
- - Basic OGIzNjcyOWUzMmU1OWJiMTBlNjEwZWZiOWFhNjExZTA6Nzg0MWEyNWU4Y2VkMmZjOGRmYzFhZGU3YWM0ZmFjZTQ=
105
+ - Basic hidden
106
106
  response:
107
107
  status:
108
108
  code: 201
@@ -154,7 +154,7 @@ http_interactions:
154
154
  Content-Type:
155
155
  - application/json
156
156
  Authorization:
157
- - Basic OGIzNjcyOWUzMmU1OWJiMTBlNjEwZWZiOWFhNjExZTA6Nzg0MWEyNWU4Y2VkMmZjOGRmYzFhZGU3YWM0ZmFjZTQ=
157
+ - Basic hidden
158
158
  response:
159
159
  status:
160
160
  code: 200
@@ -207,7 +207,7 @@ http_interactions:
207
207
  Content-Type:
208
208
  - application/json
209
209
  Authorization:
210
- - Basic OGIzNjcyOWUzMmU1OWJiMTBlNjEwZWZiOWFhNjExZTA6Nzg0MWEyNWU4Y2VkMmZjOGRmYzFhZGU3YWM0ZmFjZTQ=
210
+ - Basic hidden
211
211
  response:
212
212
  status:
213
213
  code: 200
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic secret
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 201
@@ -50,7 +50,7 @@ http_interactions:
50
50
  Content-Type:
51
51
  - application/json
52
52
  Authorization:
53
- - Basic secret
53
+ - Basic hidden
54
54
  response:
55
55
  status:
56
56
  code: 201
@@ -89,7 +89,7 @@ http_interactions:
89
89
  Content-Type:
90
90
  - application/json
91
91
  Authorization:
92
- - Basic secret
92
+ - Basic hidden
93
93
  response:
94
94
  status:
95
95
  code: 201
@@ -141,7 +141,7 @@ http_interactions:
141
141
  Content-Type:
142
142
  - application/json
143
143
  Authorization:
144
- - Basic secret
144
+ - Basic hidden
145
145
  response:
146
146
  status:
147
147
  code: 201
@@ -196,7 +196,7 @@ http_interactions:
196
196
  Content-Type:
197
197
  - application/json
198
198
  Authorization:
199
- - Basic secret
199
+ - Basic hidden
200
200
  response:
201
201
  status:
202
202
  code: 201
@@ -245,7 +245,7 @@ http_interactions:
245
245
  Content-Type:
246
246
  - application/json
247
247
  Authorization:
248
- - Basic secret
248
+ - Basic hidden
249
249
  response:
250
250
  status:
251
251
  code: 200
@@ -296,7 +296,7 @@ http_interactions:
296
296
  Content-Type:
297
297
  - application/json
298
298
  Authorization:
299
- - Basic secret
299
+ - Basic hidden
300
300
  response:
301
301
  status:
302
302
  code: 202
@@ -341,7 +341,7 @@ http_interactions:
341
341
  Content-Type:
342
342
  - application/json
343
343
  Authorization:
344
- - Basic secret
344
+ - Basic hidden
345
345
  response:
346
346
  status:
347
347
  code: 202
@@ -376,7 +376,7 @@ http_interactions:
376
376
  Content-Type:
377
377
  - application/json
378
378
  Authorization:
379
- - Basic secret
379
+ - Basic hidden
380
380
  response:
381
381
  status:
382
382
  code: 200
@@ -412,7 +412,7 @@ http_interactions:
412
412
  User-Agent:
413
413
  - Faraday v0.15.4
414
414
  Authorization:
415
- - Basic secret
415
+ - Basic hidden
416
416
  response:
417
417
  status:
418
418
  code: 204
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 201
@@ -63,7 +63,7 @@ http_interactions:
63
63
  Content-Type:
64
64
  - application/json
65
65
  Authorization:
66
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
66
+ - Basic hidden
67
67
  response:
68
68
  status:
69
69
  code: 201
@@ -114,7 +114,7 @@ http_interactions:
114
114
  Content-Type:
115
115
  - application/json
116
116
  Authorization:
117
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
117
+ - Basic hidden
118
118
  response:
119
119
  status:
120
120
  code: 201
@@ -165,7 +165,7 @@ http_interactions:
165
165
  Content-Type:
166
166
  - application/json
167
167
  Authorization:
168
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
168
+ - Basic hidden
169
169
  response:
170
170
  status:
171
171
  code: 201
@@ -214,7 +214,7 @@ http_interactions:
214
214
  Content-Type:
215
215
  - application/json
216
216
  Authorization:
217
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
217
+ - Basic hidden
218
218
  response:
219
219
  status:
220
220
  code: 200
@@ -263,7 +263,7 @@ http_interactions:
263
263
  Content-Type:
264
264
  - application/json
265
265
  Authorization:
266
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
266
+ - Basic hidden
267
267
  response:
268
268
  status:
269
269
  code: 202
@@ -306,7 +306,7 @@ http_interactions:
306
306
  User-Agent:
307
307
  - Faraday v0.9.2
308
308
  Authorization:
309
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
309
+ - Basic hidden
310
310
  response:
311
311
  status:
312
312
  code: 204
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 200
@@ -61,7 +61,7 @@ http_interactions:
61
61
  Content-Type:
62
62
  - application/json
63
63
  Authorization:
64
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
64
+ - Basic hidden
65
65
  response:
66
66
  status:
67
67
  code: 200
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic Hidden
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 200
@@ -51,7 +51,7 @@ http_interactions:
51
51
  Content-Type:
52
52
  - application/json
53
53
  Authorization:
54
- - Basic Hidden
54
+ - Basic hidden
55
55
  response:
56
56
  status:
57
57
  code: 200
@@ -102,7 +102,7 @@ http_interactions:
102
102
  Content-Type:
103
103
  - application/json
104
104
  Authorization:
105
- - Basic Hidden
105
+ - Basic hidden
106
106
  response:
107
107
  status:
108
108
  code: 202
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic Hidden
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 200
@@ -51,7 +51,7 @@ http_interactions:
51
51
  Content-Type:
52
52
  - application/json
53
53
  Authorization:
54
- - Basic Hidden
54
+ - Basic hidden
55
55
  response:
56
56
  status:
57
57
  code: 200
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic Hidden
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 200
@@ -51,7 +51,7 @@ http_interactions:
51
51
  Content-Type:
52
52
  - application/json
53
53
  Authorization:
54
- - Basic Hidden
54
+ - Basic hidden
55
55
  response:
56
56
  status:
57
57
  code: 200
@@ -102,7 +102,7 @@ http_interactions:
102
102
  Content-Type:
103
103
  - application/json
104
104
  Authorization:
105
- - Basic Mjk5ZjAyMjYzMDRkNThhNWZiYzFlNTcwOTdlZGU3Mjk6OWM4NWIwNGFkN2FjNzE2NTUwYTY1NjZhZWYwYzM5ZmU=
105
+ - Basic hidden
106
106
  response:
107
107
  status:
108
108
  code: 202
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic Hidden
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 200
@@ -51,7 +51,7 @@ http_interactions:
51
51
  Content-Type:
52
52
  - application/json
53
53
  Authorization:
54
- - Basic Hidden
54
+ - Basic hidden
55
55
  response:
56
56
  status:
57
57
  code: 200
@@ -102,7 +102,7 @@ http_interactions:
102
102
  Content-Type:
103
103
  - application/json
104
104
  Authorization:
105
- - Basic Mjk5ZjAyMjYzMDRkNThhNWZiYzFlNTcwOTdlZGU3Mjk6OWM4NWIwNGFkN2FjNzE2NTUwYTY1NjZhZWYwYzM5ZmU=
105
+ - Basic hidden
106
106
  response:
107
107
  status:
108
108
  code: 202
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
15
+ - Basic hidden
16
16
  response:
17
17
  status:
18
18
  code: 201
@@ -63,7 +63,7 @@ http_interactions:
63
63
  Content-Type:
64
64
  - application/json
65
65
  Authorization:
66
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
66
+ - Basic hidden
67
67
  response:
68
68
  status:
69
69
  code: 201
@@ -113,7 +113,7 @@ http_interactions:
113
113
  Content-Type:
114
114
  - application/json
115
115
  Authorization:
116
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
116
+ - Basic hidden
117
117
  response:
118
118
  status:
119
119
  code: 201
@@ -162,7 +162,7 @@ http_interactions:
162
162
  Content-Type:
163
163
  - application/json
164
164
  Authorization:
165
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
165
+ - Basic hidden
166
166
  response:
167
167
  status:
168
168
  code: 201
@@ -209,7 +209,7 @@ http_interactions:
209
209
  User-Agent:
210
210
  - Faraday v0.9.2
211
211
  Authorization:
212
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
212
+ - Basic hidden
213
213
  response:
214
214
  status:
215
215
  code: 204
data/lib/chartmogul.rb CHANGED
@@ -43,6 +43,7 @@ require 'chartmogul/concerns/entries'
43
43
  require 'chartmogul/concerns/summary'
44
44
  require 'chartmogul/concerns/pageable'
45
45
  require 'chartmogul/concerns/pageable2'
46
+ require 'chartmogul/concerns/pageable_with_anchor'
46
47
 
47
48
  require 'chartmogul/subscription'
48
49
  require 'chartmogul/invoice'
@@ -53,6 +54,7 @@ require 'chartmogul/ping'
53
54
  require 'chartmogul/plan'
54
55
  require 'chartmogul/plan_group'
55
56
  require 'chartmogul/plan_groups/plans'
57
+ require 'chartmogul/account'
56
58
 
57
59
  require 'chartmogul/metrics/arpa'
58
60
  require 'chartmogul/metrics/arr'
@@ -65,8 +67,9 @@ require 'chartmogul/metrics/mrr_churn_rate'
65
67
  require 'chartmogul/metrics/all_key_metrics'
66
68
  require 'chartmogul/metrics/base'
67
69
 
70
+ require 'chartmogul/metrics/customers/activity'
71
+ require 'chartmogul/metrics/customers/subscription'
68
72
  require 'chartmogul/metrics/activity'
69
- require 'chartmogul/metrics/subscription'
70
73
 
71
74
  require 'chartmogul/enrichment/customer'
72
75
 
@@ -78,10 +81,14 @@ module ChartMogul
78
81
  class << self
79
82
  extend ConfigAttributes
80
83
 
84
+ def global_config
85
+ @global_config ||= ChartMogul::Configuration.new
86
+ end
81
87
 
88
+ # This configuration is thread-safe and fits multi-account async
89
+ # jobs processing use case.
82
90
  def config
83
- Thread.current[CONFIG_THREAD_KEY] = ChartMogul::Configuration.new if Thread.current[CONFIG_THREAD_KEY].nil?
84
- Thread.current[CONFIG_THREAD_KEY]
91
+ Thread.current[CONFIG_THREAD_KEY] ||= ChartMogul::Configuration.new
85
92
  end
86
93
 
87
94
  config_accessor :account_token
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ChartMogul
4
+ class Account < APIResource
5
+ set_resource_name 'Account'
6
+ set_resource_path '/v1/account'
7
+
8
+ readonly_attr :name
9
+ readonly_attr :currency
10
+ readonly_attr :time_zone
11
+ readonly_attr :week_start_on
12
+
13
+ include API::Actions::Custom
14
+
15
+ def self.retrieve
16
+ custom!(:get, '/v1/account')
17
+ end
18
+ end
19
+ end
@@ -15,7 +15,8 @@ module ChartMogul
15
15
  req.headers['Content-Type'] = 'application/json'
16
16
  end
17
17
  end
18
- json = ChartMogul::Utils::JSONParser.parse(resp.body)
18
+
19
+ json = ChartMogul::Utils::JSONParser.parse(resp.body, immutable_keys: immutable_keys)
19
20
  new_from_json(json)
20
21
  end
21
22
  end
@@ -15,7 +15,7 @@ module ChartMogul
15
15
  req.body = JSON.dump(serialize_for_write)
16
16
  end
17
17
  end
18
- json = ChartMogul::Utils::JSONParser.parse(resp.body, skip_case_conversion: self.class.skip_case_conversion)
18
+ json = ChartMogul::Utils::JSONParser.parse(resp.body, immutable_keys: self.class.immutable_keys)
19
19
 
20
20
  assign_all_attributes(json)
21
21
  end
@@ -30,7 +30,7 @@ module ChartMogul
30
30
  req.body = JSON.dump(resource.serialize_for_write)
31
31
  end
32
32
  end
33
- json = ChartMogul::Utils::JSONParser.parse(resp.body, skip_case_conversion: skip_case_conversion)
33
+ json = ChartMogul::Utils::JSONParser.parse(resp.body, immutable_keys: immutable_keys)
34
34
 
35
35
  new_from_json(json)
36
36
  end