chartmogul-ruby 1.5.1 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +5 -1
  4. data/Gemfile +2 -0
  5. data/LICENSE.txt +1 -1
  6. data/README.md +5 -3
  7. data/Rakefile +2 -0
  8. data/bin/console +1 -0
  9. data/chartmogul-ruby.gemspec +21 -17
  10. data/fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_in_a_threaded_environment.yml +112 -0
  11. data/fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_when_credentials_are_updated.yml +77 -0
  12. data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_customer_using_class_method.yml +53 -0
  13. data/fixtures/vcr_cassettes/ChartMogul_CustomerInvoices/API_Interactions/correctly_interracts_with_the_API.yml +148 -109
  14. data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/updates_existing_plan_using_class_method.yml +164 -0
  15. data/fixtures/vcr_cassettes/ChartMogul_PlanGroup/API_interactions/updates_existing_plan_group_name_via_class_method.yml +297 -0
  16. data/lib/chartmogul.rb +8 -2
  17. data/lib/chartmogul/api/actions/all.rb +2 -0
  18. data/lib/chartmogul/api/actions/create.rb +2 -0
  19. data/lib/chartmogul/api/actions/custom.rb +2 -0
  20. data/lib/chartmogul/api/actions/destroy.rb +2 -0
  21. data/lib/chartmogul/api/actions/retrieve.rb +2 -0
  22. data/lib/chartmogul/api/actions/update.rb +22 -0
  23. data/lib/chartmogul/api_resource.rb +21 -12
  24. data/lib/chartmogul/concerns/entries.rb +2 -0
  25. data/lib/chartmogul/concerns/pageable.rb +2 -0
  26. data/lib/chartmogul/concerns/pageable2.rb +2 -0
  27. data/lib/chartmogul/concerns/summary.rb +2 -0
  28. data/lib/chartmogul/config_attributes.rb +7 -1
  29. data/lib/chartmogul/configuration.rb +3 -0
  30. data/lib/chartmogul/customer.rb +2 -0
  31. data/lib/chartmogul/customer_invoices.rb +11 -0
  32. data/lib/chartmogul/data_source.rb +2 -0
  33. data/lib/chartmogul/enrichment/customer.rb +2 -0
  34. data/lib/chartmogul/errors/chartmogul_error.rb +2 -0
  35. data/lib/chartmogul/errors/configuration_error.rb +2 -0
  36. data/lib/chartmogul/errors/forbidden_error.rb +2 -0
  37. data/lib/chartmogul/errors/not_found_error.rb +2 -0
  38. data/lib/chartmogul/errors/resource_invalid_error.rb +2 -0
  39. data/lib/chartmogul/errors/schema_invalid_error.rb +2 -0
  40. data/lib/chartmogul/errors/server_error.rb +2 -0
  41. data/lib/chartmogul/errors/unauthorized_error.rb +2 -0
  42. data/lib/chartmogul/invoice.rb +2 -0
  43. data/lib/chartmogul/line_items/one_time.rb +2 -0
  44. data/lib/chartmogul/line_items/subscription.rb +2 -0
  45. data/lib/chartmogul/metrics/activity.rb +2 -0
  46. data/lib/chartmogul/metrics/all_key_metrics.rb +2 -0
  47. data/lib/chartmogul/metrics/arpa.rb +2 -0
  48. data/lib/chartmogul/metrics/arr.rb +2 -0
  49. data/lib/chartmogul/metrics/asp.rb +2 -0
  50. data/lib/chartmogul/metrics/base.rb +6 -2
  51. data/lib/chartmogul/metrics/customer_churn_rate.rb +2 -0
  52. data/lib/chartmogul/metrics/customer_count.rb +2 -0
  53. data/lib/chartmogul/metrics/ltv.rb +2 -0
  54. data/lib/chartmogul/metrics/mrr.rb +2 -0
  55. data/lib/chartmogul/metrics/mrr_churn_rate.rb +2 -0
  56. data/lib/chartmogul/metrics/subscription.rb +2 -0
  57. data/lib/chartmogul/object.rb +2 -0
  58. data/lib/chartmogul/ping.rb +2 -0
  59. data/lib/chartmogul/plan.rb +2 -0
  60. data/lib/chartmogul/plan_group.rb +2 -0
  61. data/lib/chartmogul/plan_groups/plans.rb +2 -0
  62. data/lib/chartmogul/resource_path.rb +6 -1
  63. data/lib/chartmogul/subscription.rb +2 -0
  64. data/lib/chartmogul/summary.rb +2 -0
  65. data/lib/chartmogul/transactions/payment.rb +2 -0
  66. data/lib/chartmogul/transactions/refund.rb +2 -0
  67. data/lib/chartmogul/utils/hash_snake_caser.rb +2 -0
  68. data/lib/chartmogul/utils/json_parser.rb +11 -1
  69. data/lib/chartmogul/version.rb +3 -1
  70. metadata +64 -17
@@ -0,0 +1,164 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.chartmogul.com/v1/data_sources
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"Another Data Source"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.17.3
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Server:
26
+ - nginx/1.10.1
27
+ Date:
28
+ - Thu, 23 Jul 2020 12:33:56 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Status:
36
+ - 201 Created
37
+ Access-Control-Allow-Credentials:
38
+ - 'true'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"uuid":"ds_c65f219c-cce0-11ea-a43a-8745a9a809c7","name":"Another Data
42
+ Source","system":"Import API","created_at":"2020-07-23T12:33:56.076Z","status":"idle"}'
43
+ http_version: null
44
+ recorded_at: Thu, 23 Jul 2020 12:33:56 GMT
45
+ - request:
46
+ method: post
47
+ uri: https://api.chartmogul.com/v1/plans
48
+ body:
49
+ encoding: UTF-8
50
+ string: '{"name":"pro","interval_count":1,"interval_unit":"month","data_source_uuid":"ds_c65f219c-cce0-11ea-a43a-8745a9a809c7"}'
51
+ headers:
52
+ User-Agent:
53
+ - Faraday v0.17.3
54
+ Content-Type:
55
+ - application/json
56
+ Authorization:
57
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
58
+ Accept-Encoding:
59
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60
+ Accept:
61
+ - "*/*"
62
+ response:
63
+ status:
64
+ code: 201
65
+ message: Created
66
+ headers:
67
+ Server:
68
+ - nginx/1.10.1
69
+ Date:
70
+ - Thu, 23 Jul 2020 12:33:57 GMT
71
+ Content-Type:
72
+ - application/json; charset=utf-8
73
+ Transfer-Encoding:
74
+ - chunked
75
+ Connection:
76
+ - keep-alive
77
+ Status:
78
+ - 201 Created
79
+ X-Frame-Options:
80
+ - SAMEORIGIN
81
+ X-Xss-Protection:
82
+ - 1; mode=block
83
+ X-Content-Type-Options:
84
+ - nosniff
85
+ X-Download-Options:
86
+ - noopen
87
+ X-Permitted-Cross-Domain-Policies:
88
+ - none
89
+ Referrer-Policy:
90
+ - strict-origin-when-cross-origin
91
+ Etag:
92
+ - W/"ea419983710a24c40e13cc17133cfad5"
93
+ Cache-Control:
94
+ - max-age=0, private, must-revalidate
95
+ X-Request-Id:
96
+ - 8c6f92d6-c5f2-47ec-9bca-bb42bf2906bd
97
+ X-Runtime:
98
+ - '0.107610'
99
+ Strict-Transport-Security:
100
+ - max-age=15768000
101
+ body:
102
+ encoding: UTF-8
103
+ string: '{"external_id":"b37d52c0-af0e-0138-9570-42eead14b4ad","name":"pro","interval_count":1,"interval_unit":"month","data_source_uuid":"ds_c65f219c-cce0-11ea-a43a-8745a9a809c7","uuid":"pl_b37d52c0-af0e-0138-9570-42eead14b4ad"}'
104
+ http_version: null
105
+ recorded_at: Thu, 23 Jul 2020 12:33:57 GMT
106
+ - request:
107
+ method: patch
108
+ uri: https://api.chartmogul.com/v1/plans/pl_b37d52c0-af0e-0138-9570-42eead14b4ad
109
+ body:
110
+ encoding: UTF-8
111
+ string: '{"name":"really pro","interval_count":2}'
112
+ headers:
113
+ User-Agent:
114
+ - Faraday v0.17.3
115
+ Content-Type:
116
+ - application/json
117
+ Authorization:
118
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
119
+ Accept-Encoding:
120
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
121
+ Accept:
122
+ - "*/*"
123
+ response:
124
+ status:
125
+ code: 202
126
+ message: Accepted
127
+ headers:
128
+ Server:
129
+ - nginx/1.10.1
130
+ Date:
131
+ - Thu, 23 Jul 2020 12:33:58 GMT
132
+ Content-Type:
133
+ - application/json; charset=utf-8
134
+ Transfer-Encoding:
135
+ - chunked
136
+ Connection:
137
+ - keep-alive
138
+ Status:
139
+ - 202 Accepted
140
+ X-Frame-Options:
141
+ - SAMEORIGIN
142
+ X-Xss-Protection:
143
+ - 1; mode=block
144
+ X-Content-Type-Options:
145
+ - nosniff
146
+ X-Download-Options:
147
+ - noopen
148
+ X-Permitted-Cross-Domain-Policies:
149
+ - none
150
+ Referrer-Policy:
151
+ - strict-origin-when-cross-origin
152
+ Cache-Control:
153
+ - no-cache
154
+ X-Request-Id:
155
+ - fcc52966-8abd-442b-a9cd-e14a35988163
156
+ X-Runtime:
157
+ - '0.125362'
158
+ body:
159
+ encoding: UTF-8
160
+ string: '{"external_id":"b37d52c0-af0e-0138-9570-42eead14b4ad","name":"really
161
+ pro","interval_count":2,"interval_unit":"month","data_source_uuid":"ds_c65f219c-cce0-11ea-a43a-8745a9a809c7","uuid":"pl_b37d52c0-af0e-0138-9570-42eead14b4ad"}'
162
+ http_version: null
163
+ recorded_at: Thu, 23 Jul 2020 12:33:58 GMT
164
+ recorded_with: VCR 5.1.0
@@ -0,0 +1,297 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.chartmogul.com/v1/data_sources
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"Data Source #1"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.17.3
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Server:
26
+ - nginx/1.10.1
27
+ Date:
28
+ - Thu, 23 Jul 2020 12:34:26 GMT
29
+ Content-Type:
30
+ - application/json
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Status:
36
+ - 201 Created
37
+ Access-Control-Allow-Credentials:
38
+ - 'true'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"uuid":"ds_d83adf5a-cce0-11ea-a43a-0bee9fce502d","name":"Data Source
42
+ #1","system":"Import API","created_at":"2020-07-23T12:34:26.033Z","status":"idle"}'
43
+ http_version: null
44
+ recorded_at: Thu, 23 Jul 2020 12:34:26 GMT
45
+ - request:
46
+ method: post
47
+ uri: https://api.chartmogul.com/v1/plans
48
+ body:
49
+ encoding: UTF-8
50
+ string: '{"name":"A Test Plan","interval_count":1,"interval_unit":"month","data_source_uuid":"ds_d83adf5a-cce0-11ea-a43a-0bee9fce502d"}'
51
+ headers:
52
+ User-Agent:
53
+ - Faraday v0.17.3
54
+ Content-Type:
55
+ - application/json
56
+ Authorization:
57
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
58
+ Accept-Encoding:
59
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60
+ Accept:
61
+ - "*/*"
62
+ response:
63
+ status:
64
+ code: 201
65
+ message: Created
66
+ headers:
67
+ Server:
68
+ - nginx/1.10.1
69
+ Date:
70
+ - Thu, 23 Jul 2020 12:34:27 GMT
71
+ Content-Type:
72
+ - application/json; charset=utf-8
73
+ Transfer-Encoding:
74
+ - chunked
75
+ Connection:
76
+ - keep-alive
77
+ Status:
78
+ - 201 Created
79
+ X-Frame-Options:
80
+ - SAMEORIGIN
81
+ X-Xss-Protection:
82
+ - 1; mode=block
83
+ X-Content-Type-Options:
84
+ - nosniff
85
+ X-Download-Options:
86
+ - noopen
87
+ X-Permitted-Cross-Domain-Policies:
88
+ - none
89
+ Referrer-Policy:
90
+ - strict-origin-when-cross-origin
91
+ Etag:
92
+ - W/"c69ec995cb9bab078fd6c88a194a33e0"
93
+ Cache-Control:
94
+ - max-age=0, private, must-revalidate
95
+ X-Request-Id:
96
+ - 21bb8417-4520-4b9f-aded-46d155615e98
97
+ X-Runtime:
98
+ - '0.119008'
99
+ Strict-Transport-Security:
100
+ - max-age=15768000
101
+ body:
102
+ encoding: UTF-8
103
+ string: '{"external_id":"c5723000-af0e-0138-d912-62b37fb4c770","name":"A Test
104
+ Plan","interval_count":1,"interval_unit":"month","data_source_uuid":"ds_d83adf5a-cce0-11ea-a43a-0bee9fce502d","uuid":"pl_c5723000-af0e-0138-d912-62b37fb4c770"}'
105
+ http_version: null
106
+ recorded_at: Thu, 23 Jul 2020 12:34:27 GMT
107
+ - request:
108
+ method: post
109
+ uri: https://api.chartmogul.com/v1/plans
110
+ body:
111
+ encoding: UTF-8
112
+ string: '{"name":"A another Test Plan","interval_count":1,"interval_unit":"month","data_source_uuid":"ds_d83adf5a-cce0-11ea-a43a-0bee9fce502d"}'
113
+ headers:
114
+ User-Agent:
115
+ - Faraday v0.17.3
116
+ Content-Type:
117
+ - application/json
118
+ Authorization:
119
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
120
+ Accept-Encoding:
121
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
122
+ Accept:
123
+ - "*/*"
124
+ response:
125
+ status:
126
+ code: 201
127
+ message: Created
128
+ headers:
129
+ Server:
130
+ - nginx/1.10.1
131
+ Date:
132
+ - Thu, 23 Jul 2020 12:34:28 GMT
133
+ Content-Type:
134
+ - application/json; charset=utf-8
135
+ Transfer-Encoding:
136
+ - chunked
137
+ Connection:
138
+ - keep-alive
139
+ Status:
140
+ - 201 Created
141
+ X-Frame-Options:
142
+ - SAMEORIGIN
143
+ X-Xss-Protection:
144
+ - 1; mode=block
145
+ X-Content-Type-Options:
146
+ - nosniff
147
+ X-Download-Options:
148
+ - noopen
149
+ X-Permitted-Cross-Domain-Policies:
150
+ - none
151
+ Referrer-Policy:
152
+ - strict-origin-when-cross-origin
153
+ Etag:
154
+ - W/"392434626ecc2ec07e9bb64179d07e58"
155
+ Cache-Control:
156
+ - max-age=0, private, must-revalidate
157
+ X-Request-Id:
158
+ - f9570c06-bfc2-4cce-b9e2-ec2ad88e2a1a
159
+ X-Runtime:
160
+ - '0.114808'
161
+ Strict-Transport-Security:
162
+ - max-age=15768000
163
+ body:
164
+ encoding: UTF-8
165
+ string: '{"external_id":"c61dc800-af0e-0138-1702-4e501129bd4a","name":"A another
166
+ Test Plan","interval_count":1,"interval_unit":"month","data_source_uuid":"ds_d83adf5a-cce0-11ea-a43a-0bee9fce502d","uuid":"pl_c61dc800-af0e-0138-1702-4e501129bd4a"}'
167
+ http_version: null
168
+ recorded_at: Thu, 23 Jul 2020 12:34:28 GMT
169
+ - request:
170
+ method: post
171
+ uri: https://api.chartmogul.com/v1/plan_groups
172
+ body:
173
+ encoding: UTF-8
174
+ string: '{"name":"My plan group","plans":["pl_c5723000-af0e-0138-d912-62b37fb4c770","pl_c61dc800-af0e-0138-1702-4e501129bd4a"]}'
175
+ headers:
176
+ User-Agent:
177
+ - Faraday v0.17.3
178
+ Content-Type:
179
+ - application/json
180
+ Authorization:
181
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
182
+ Accept-Encoding:
183
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
184
+ Accept:
185
+ - "*/*"
186
+ response:
187
+ status:
188
+ code: 200
189
+ message: OK
190
+ headers:
191
+ Server:
192
+ - nginx/1.10.1
193
+ Date:
194
+ - Thu, 23 Jul 2020 12:34:29 GMT
195
+ Content-Type:
196
+ - application/json; charset=utf-8
197
+ Transfer-Encoding:
198
+ - chunked
199
+ Connection:
200
+ - keep-alive
201
+ Vary:
202
+ - Accept-Encoding
203
+ - Accept-Encoding
204
+ Status:
205
+ - 200 OK
206
+ X-Frame-Options:
207
+ - SAMEORIGIN
208
+ X-Xss-Protection:
209
+ - 1; mode=block
210
+ X-Content-Type-Options:
211
+ - nosniff
212
+ X-Download-Options:
213
+ - noopen
214
+ X-Permitted-Cross-Domain-Policies:
215
+ - none
216
+ Referrer-Policy:
217
+ - strict-origin-when-cross-origin
218
+ Etag:
219
+ - W/"1b33f81c506f9371501c358293e5c25e"
220
+ Cache-Control:
221
+ - max-age=0, private, must-revalidate
222
+ X-Request-Id:
223
+ - 96425a8f-ad6a-4d43-883a-28809e5e8fd2
224
+ X-Runtime:
225
+ - '0.055173'
226
+ Strict-Transport-Security:
227
+ - max-age=15768000
228
+ body:
229
+ encoding: ASCII-8BIT
230
+ string: '{"name":"My plan group","uuid":"plg_36d737ca-b021-4fc7-a8ee-8636fb6db2cc","plans_count":2}'
231
+ http_version: null
232
+ recorded_at: Thu, 23 Jul 2020 12:34:29 GMT
233
+ - request:
234
+ method: patch
235
+ uri: https://api.chartmogul.com/v1/plan_groups/plg_36d737ca-b021-4fc7-a8ee-8636fb6db2cc
236
+ body:
237
+ encoding: UTF-8
238
+ string: '{"name":"A new group name"}'
239
+ headers:
240
+ User-Agent:
241
+ - Faraday v0.17.3
242
+ Content-Type:
243
+ - application/json
244
+ Authorization:
245
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
246
+ Accept-Encoding:
247
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
248
+ Accept:
249
+ - "*/*"
250
+ response:
251
+ status:
252
+ code: 200
253
+ message: OK
254
+ headers:
255
+ Server:
256
+ - nginx/1.10.1
257
+ Date:
258
+ - Thu, 23 Jul 2020 12:34:30 GMT
259
+ Content-Type:
260
+ - application/json; charset=utf-8
261
+ Transfer-Encoding:
262
+ - chunked
263
+ Connection:
264
+ - keep-alive
265
+ Vary:
266
+ - Accept-Encoding
267
+ - Accept-Encoding
268
+ Status:
269
+ - 200 OK
270
+ X-Frame-Options:
271
+ - SAMEORIGIN
272
+ X-Xss-Protection:
273
+ - 1; mode=block
274
+ X-Content-Type-Options:
275
+ - nosniff
276
+ X-Download-Options:
277
+ - noopen
278
+ X-Permitted-Cross-Domain-Policies:
279
+ - none
280
+ Referrer-Policy:
281
+ - strict-origin-when-cross-origin
282
+ Etag:
283
+ - W/"b12ead83619d709fd1285016e6daec9b"
284
+ Cache-Control:
285
+ - max-age=0, private, must-revalidate
286
+ X-Request-Id:
287
+ - 27ca96d6-4e17-4c89-b030-6fcae8131bb3
288
+ X-Runtime:
289
+ - '0.044140'
290
+ Strict-Transport-Security:
291
+ - max-age=15768000
292
+ body:
293
+ encoding: ASCII-8BIT
294
+ string: '{"name":"A new group name","uuid":"plg_36d737ca-b021-4fc7-a8ee-8636fb6db2cc","plans_count":2}'
295
+ http_version: null
296
+ recorded_at: Thu, 23 Jul 2020 12:34:30 GMT
297
+ recorded_with: VCR 5.1.0