chartmogul-ruby 1.6.2 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08fe9cbc3ec7071bb35a489da5996c3a029ba6b78205fee4d824327951efa491'
4
- data.tar.gz: cd1f5597219b881df4a19619fae2de8daa599015bb8e65829c2d5b0ed5003f5a
3
+ metadata.gz: 9dda2af29a185fd3a055fbfa3eeed97099989826a85f356e90ca7d0878757df2
4
+ data.tar.gz: 62a743e3b125b484e2993c6d539a8ec7f1ce7da67b2d40bc19d6853cee85fdd3
5
5
  SHA512:
6
- metadata.gz: ec8e502004838ba41f47c61caf5fef16315d10a90ccd1c9cd4d761382c3499225749cee94fbd582d0ad1e997f2ffaa24a9abb6b6e8751b1228cb69f88fed1992
7
- data.tar.gz: 5e21bf5afced99d731e23566306032875c21b5292807ca5ffc873e13abd3f7187d8a4cb77c375de7840a93f2d3d8ef114c8a8f94bc8fa47a5e34689b80e9d455
6
+ metadata.gz: 2bda6fc0c8a5266d528b7cc41d71da5f1b5471c0b526d2a7008cc93cb92f6c07fa7029af93801db3f24b07c79e035be9841324c9e4a6212c0ff4f510ceea82ec
7
+ data.tar.gz: 2c666f0cb45b87c1d4ca453e966d935680ed836dd0e3178b8b35c2e89e4094827b7baa297fea5669e3560fc5d5b436b1a42b3fdcb5e786a00d5163ddfe40f7f6
Binary file
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  *.swp
11
11
  vendor/bundle
12
+ /.idea
@@ -1,5 +1,11 @@
1
1
  # chartmogul-ruby Change Log
2
2
 
3
+ ## Version 1.6.8 -1 November 2020
4
+ - Add support for subscription_external_id when listing Activities
5
+
6
+ ## Version 1.6.7 - 8 September 2020
7
+ - Allow adding Customer custom attributes in camel case
8
+
3
9
  ## Version 1.5.0 - 20 February 2020
4
10
  - Add support for plan groups API
5
11
 
@@ -5,22 +5,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'chartmogul/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'chartmogul-ruby'
9
- spec.version = ChartMogul::VERSION
10
- spec.authors = ['Petr Kopac']
11
- spec.email = ['petr@chartmogul.com']
8
+ spec.name = 'chartmogul-ruby'
9
+ spec.version = ChartMogul::VERSION
10
+ spec.authors = ['Petr Kopac']
11
+ spec.email = ['petr@chartmogul.com']
12
12
 
13
- spec.summary = 'Chartmogul API Ruby Client'
14
- spec.description = 'Official Ruby client for ChartMogul\'s API'
15
- spec.homepage = 'https://github.com/chartmogul/chartmogul-ruby'
16
- spec.license = 'MIT'
13
+ spec.summary = 'Chartmogul API Ruby Client'
14
+ spec.description = 'Official Ruby client for ChartMogul\'s API'
15
+ spec.homepage = 'https://github.com/chartmogul/chartmogul-ruby'
16
+ spec.license = 'MIT'
17
+ spec.required_ruby_version = '>= 2.3'
17
18
 
18
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- spec.bindir = 'exe'
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ['lib']
19
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
22
23
 
23
- spec.add_dependency 'faraday', '~> 0.17.3'
24
+ spec.add_dependency 'faraday', '~> 1.0.0'
24
25
 
25
26
  spec.add_development_dependency 'bundler', '~> 2'
26
27
  spec.add_development_dependency 'pry', '~> 0.12.2'
@@ -44,7 +44,7 @@ http_interactions:
44
44
  uri: https://api.chartmogul.com/v1/customers/cus_07393ece-aab1-4255-8bcd-0ef11e24b047/attributes/custom
45
45
  body:
46
46
  encoding: UTF-8
47
- string: '{"custom":[{"type":"String","key":"string_key","value":"String Value"},{"type":"Integer","key":"integer_key","value":1234},{"type":"Timestamp","key":"timestamp_key","value":"2016-01-31
47
+ string: '{"custom":[{"type":"String","key":"StringKey","value":"String Value"},{"type":"Integer","key":"integer_key","value":1234},{"type":"Timestamp","key":"timestamp_key","value":"2016-01-31
48
48
  00:00:00 UTC"},{"type":"Boolean","key":"boolean_key","value":true}]}'
49
49
  headers:
50
50
  User-Agent:
@@ -74,7 +74,7 @@ http_interactions:
74
74
  - 'true'
75
75
  body:
76
76
  encoding: UTF-8
77
- string: '{"custom":{"string_key":"String Value","integer_key":1234,"timestamp_key":"2016-01-31T00:00:00.000Z","boolean_key":true}}'
77
+ string: '{"custom":{"StringKey":"String Value","integer_key":1234,"timestamp_key":"2016-01-31T00:00:00.000Z","boolean_key":true}}'
78
78
  http_version:
79
79
  recorded_at: Wed, 29 Jun 2016 12:47:09 GMT
80
80
  recorded_with: VCR 3.0.3
@@ -45,7 +45,7 @@ http_interactions:
45
45
  uri: https://api.chartmogul.com/v1/customers/cus_07393ece-aab1-4255-8bcd-0ef11e24b047/attributes/custom
46
46
  body:
47
47
  encoding: UTF-8
48
- string: '{"custom":{"string_key":"Another String Value","integer_key":5678,"timestamp_key":"2016-02-01
48
+ string: '{"custom":{"StringKey":"Another String Value","integer_key":5678,"timestamp_key":"2016-02-01
49
49
  00:00:00 UTC","boolean_key":false}}'
50
50
  headers:
51
51
  User-Agent:
@@ -75,7 +75,7 @@ http_interactions:
75
75
  - 'true'
76
76
  body:
77
77
  encoding: UTF-8
78
- string: '{"custom":{"string_key":"Another String Value","integer_key":5678,"timestamp_key":"2016-02-01T00:00:00.000Z","boolean_key":false}}'
78
+ string: '{"custom":{"StringKey":"Another String Value","integer_key":5678,"timestamp_key":"2016-02-01T00:00:00.000Z","boolean_key":false}}'
79
79
  http_version:
80
80
  recorded_at: Wed, 29 Jun 2016 12:47:09 GMT
81
81
  recorded_with: VCR 3.0.3
@@ -8,291 +8,330 @@ http_interactions:
8
8
  string: '{"name":"Customer Invoices Test Data Source"}'
9
9
  headers:
10
10
  User-Agent:
11
- - Faraday v0.9.2
11
+ - Faraday v1.0.1
12
12
  Content-Type:
13
13
  - application/json
14
14
  Authorization:
15
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
15
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
16
16
  response:
17
17
  status:
18
18
  code: 201
19
- message:
19
+ message: Created
20
20
  headers:
21
21
  server:
22
- - nginx/1.9.10
22
+ - nginx/1.10.1
23
23
  date:
24
- - Wed, 22 Jun 2016 15:34:41 GMT
24
+ - Fri, 14 Aug 2020 08:21:40 GMT
25
25
  content-type:
26
- - application/json; charset=utf-8
26
+ - application/json
27
27
  transfer-encoding:
28
28
  - chunked
29
29
  connection:
30
- - close
31
- x-frame-options:
32
- - SAMEORIGIN
33
- x-xss-protection:
34
- - 1; mode=block
35
- x-content-type-options:
36
- - nosniff
37
- etag:
38
- - W/"60451ca489b1142994522bdcd2a78022"
39
- cache-control:
40
- - max-age=0, private, must-revalidate
41
- x-request-id:
42
- - 14e68eba-6131-4b04-8210-d9901cadd7ef
43
- x-runtime:
44
- - '0.536866'
45
- strict-transport-security:
46
- - max-age=15768000
30
+ - keep-alive
31
+ status:
32
+ - 201 Created
33
+ access-control-allow-credentials:
34
+ - 'true'
47
35
  body:
48
36
  encoding: UTF-8
49
- string: '{"uuid":"ds_9fb17361-f24c-4c13-a25d-4c08fbc7132e","name":"Customer
50
- Invoices Test Data Source","created_at":"2016-06-22T15:34:41.041Z","status":"never_imported"}'
37
+ string: '{"uuid":"ds_2db7bab6-de07-11ea-a4dd-7f82d51c3d05","name":"Customer
38
+ Invoices Test Data Source","system":"Import API","created_at":"2020-08-14T08:21:40.103Z","status":"idle"}'
51
39
  http_version:
52
- recorded_at: Wed, 22 Jun 2016 15:34:41 GMT
40
+ recorded_at: Fri, 14 Aug 2020 08:21:40 GMT
53
41
  - request:
54
42
  method: post
55
43
  uri: https://api.chartmogul.com/v1/customers
56
44
  body:
57
45
  encoding: UTF-8
58
- string: '{"data_source_uuid":"ds_9fb17361-f24c-4c13-a25d-4c08fbc7132e","external_id":"test_cus_ext_id","name":"Test
59
- Customer","email":"test@customer.com","company":null,"country":"DE","state":null,"city":"Berlin","zip":null}'
46
+ string: '{"external_id":"test_cus_ext_id","name":"Test Customer","email":"test@customer.com","country":"DE","city":"Berlin","data_source_uuid":"ds_2db7bab6-de07-11ea-a4dd-7f82d51c3d05"}'
60
47
  headers:
61
48
  User-Agent:
62
- - Faraday v0.9.2
49
+ - Faraday v1.0.1
63
50
  Content-Type:
64
51
  - application/json
65
52
  Authorization:
66
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
53
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
67
54
  response:
68
55
  status:
69
56
  code: 201
70
- message:
57
+ message: Created
71
58
  headers:
72
59
  server:
73
- - nginx/1.9.10
60
+ - nginx/1.10.1
74
61
  date:
75
- - Wed, 22 Jun 2016 15:34:41 GMT
62
+ - Fri, 14 Aug 2020 08:21:40 GMT
76
63
  content-type:
77
- - application/json; charset=utf-8
64
+ - application/json
78
65
  transfer-encoding:
79
66
  - chunked
80
67
  connection:
81
- - close
82
- x-frame-options:
83
- - SAMEORIGIN
84
- x-xss-protection:
85
- - 1; mode=block
86
- x-content-type-options:
87
- - nosniff
88
- etag:
89
- - W/"b207f005123ccc7fbe07e3cf8d4ef474"
90
- cache-control:
91
- - max-age=0, private, must-revalidate
92
- x-request-id:
93
- - 8b32a149-5c4a-4b14-a82f-666adaf3897a
94
- x-runtime:
95
- - '0.221606'
96
- strict-transport-security:
97
- - max-age=15768000
68
+ - keep-alive
69
+ status:
70
+ - 201 Created
71
+ access-control-allow-credentials:
72
+ - 'true'
98
73
  body:
99
74
  encoding: UTF-8
100
- string: '{"uuid":"cus_5417b49e-7ea8-474a-b6bc-5bbb406c15c0","external_id":"test_cus_ext_id","name":"Test
101
- Customer","company":"","email":"test@customer.com","city":"Berlin","state":"","country":"DE","zip":"","data_source_uuid":"ds_9fb17361-f24c-4c13-a25d-4c08fbc7132e"}'
75
+ string: '{"id":58654367,"uuid":"cus_2e010ebe-de07-11ea-a4dd-ff06789b4dcf","external_id":"test_cus_ext_id","name":"Test
76
+ Customer","email":"test@customer.com","status":"Lead","customer-since":null,"attributes":{"custom":{},"clearbit":{},"stripe":{},"tags":[]},"data_source_uuid":"ds_2db7bab6-de07-11ea-a4dd-7f82d51c3d05","data_source_uuids":["ds_2db7bab6-de07-11ea-a4dd-7f82d51c3d05"],"external_ids":["test_cus_ext_id"],"company":"","country":"DE","state":null,"city":"Berlin","zip":null,"lead_created_at":null,"free_trial_started_at":null,"address":{"country":"Germany","state":null,"city":"Berlin","address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#customers/58654367-Test_Customer","billing-system-type":"Import
77
+ API","currency":"USD","currency-sign":"$"}'
102
78
  http_version:
103
- recorded_at: Wed, 22 Jun 2016 15:34:41 GMT
79
+ recorded_at: Fri, 14 Aug 2020 08:21:40 GMT
104
80
  - request:
105
81
  method: post
106
82
  uri: https://api.chartmogul.com/v1/plans
107
83
  body:
108
84
  encoding: UTF-8
109
- string: '{"data_source_uuid":"ds_9fb17361-f24c-4c13-a25d-4c08fbc7132e","name":"Test
110
- Plan","interval_count":7,"interval_unit":"day","external_id":"test_cus_pl_ext_id"}'
85
+ string: '{"name":"Test Plan","interval_count":7,"interval_unit":"day","external_id":"test_cus_pl_ext_id","data_source_uuid":"ds_2db7bab6-de07-11ea-a4dd-7f82d51c3d05"}'
111
86
  headers:
112
87
  User-Agent:
113
- - Faraday v0.9.2
88
+ - Faraday v1.0.1
114
89
  Content-Type:
115
90
  - application/json
116
91
  Authorization:
117
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
92
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
118
93
  response:
119
94
  status:
120
95
  code: 201
121
- message:
96
+ message: Created
122
97
  headers:
123
98
  server:
124
- - nginx/1.9.10
99
+ - nginx/1.10.1
125
100
  date:
126
- - Wed, 22 Jun 2016 15:34:41 GMT
101
+ - Fri, 14 Aug 2020 08:21:41 GMT
127
102
  content-type:
128
103
  - application/json; charset=utf-8
129
104
  transfer-encoding:
130
105
  - chunked
131
106
  connection:
132
- - close
107
+ - keep-alive
108
+ status:
109
+ - 201 Created
133
110
  x-frame-options:
134
111
  - SAMEORIGIN
135
112
  x-xss-protection:
136
113
  - 1; mode=block
137
114
  x-content-type-options:
138
115
  - nosniff
116
+ x-download-options:
117
+ - noopen
118
+ x-permitted-cross-domain-policies:
119
+ - none
120
+ referrer-policy:
121
+ - strict-origin-when-cross-origin
139
122
  etag:
140
- - W/"e804690c42c3d5f3d9301ff57fe9e918"
123
+ - W/"1d19bf324f0b6bf397ba8851cb55543c"
141
124
  cache-control:
142
125
  - max-age=0, private, must-revalidate
143
126
  x-request-id:
144
- - 9473bcf9-6970-4be8-a418-d2ae2988fa0c
127
+ - cbb7d1e3-f3a4-4ba2-b85c-7d3eed91922d
145
128
  x-runtime:
146
- - '0.050208'
129
+ - '0.350185'
147
130
  strict-transport-security:
148
131
  - max-age=15768000
149
132
  body:
150
133
  encoding: UTF-8
151
- string: '{"uuid":"pl_209e4674-1258-4a35-8378-9b15c4086965","external_id":"test_cus_pl_ext_id","name":"Test
152
- Plan","interval_count":7,"interval_unit":"day","data_source_uuid":"ds_9fb17361-f24c-4c13-a25d-4c08fbc7132e"}'
134
+ string: '{"external_id":"test_cus_pl_ext_id","name":"Test Plan","interval_count":7,"interval_unit":"day","data_source_uuid":"ds_2db7bab6-de07-11ea-a4dd-7f82d51c3d05","uuid":"pl_2e010ebf-de07-11ea-a4dd-8bf0a8234993"}'
153
135
  http_version:
154
- recorded_at: Wed, 22 Jun 2016 15:34:41 GMT
136
+ recorded_at: Fri, 14 Aug 2020 08:21:41 GMT
155
137
  - request:
156
138
  method: get
157
- uri: https://api.chartmogul.com/v1/import/customers/cus_5417b49e-7ea8-474a-b6bc-5bbb406c15c0/invoices
139
+ uri: https://api.chartmogul.com/v1/import/customers/cus_2e010ebe-de07-11ea-a4dd-ff06789b4dcf/invoices
158
140
  body:
159
141
  encoding: US-ASCII
160
142
  string: ''
161
143
  headers:
162
144
  User-Agent:
163
- - Faraday v0.9.2
145
+ - Faraday v1.0.1
164
146
  Content-Type:
165
147
  - application/json
166
148
  Authorization:
167
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
149
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
168
150
  response:
169
151
  status:
170
152
  code: 200
171
- message:
153
+ message: OK
172
154
  headers:
173
155
  server:
174
- - nginx/1.9.10
156
+ - nginx/1.10.1
175
157
  date:
176
- - Wed, 22 Jun 2016 16:08:43 GMT
158
+ - Fri, 14 Aug 2020 08:21:41 GMT
177
159
  content-type:
178
160
  - application/json; charset=utf-8
179
161
  transfer-encoding:
180
162
  - chunked
181
163
  connection:
182
- - close
164
+ - keep-alive
165
+ vary:
166
+ - Accept-Encoding, Accept-Encoding
167
+ status:
168
+ - 200 OK
183
169
  x-frame-options:
184
170
  - SAMEORIGIN
185
171
  x-xss-protection:
186
172
  - 1; mode=block
187
173
  x-content-type-options:
188
174
  - nosniff
175
+ x-download-options:
176
+ - noopen
177
+ x-permitted-cross-domain-policies:
178
+ - none
179
+ referrer-policy:
180
+ - strict-origin-when-cross-origin
189
181
  etag:
190
- - W/"cbb072e75866df2cb9be8bbdbd44920e"
182
+ - W/"aeef59b540af9e5982db384f237518a2"
191
183
  cache-control:
192
184
  - max-age=0, private, must-revalidate
193
185
  x-request-id:
194
- - 9d42e2ff-4066-4a90-99b4-b0999bdfeac6
186
+ - 47e6129d-8195-4273-9c31-170905e27755
195
187
  x-runtime:
196
- - '0.157408'
188
+ - '0.179805'
197
189
  strict-transport-security:
198
190
  - max-age=15768000
199
191
  body:
200
- encoding: UTF-8
201
- string: '{"customer_uuid":"cus_5417b49e-7ea8-474a-b6bc-5bbb406c15c0","invoices":[],"current_page":1,"total_pages":0}'
192
+ encoding: ASCII-8BIT
193
+ string: '{"customer_uuid":"cus_2e010ebe-de07-11ea-a4dd-ff06789b4dcf","invoices":[],"current_page":1,"total_pages":0}'
202
194
  http_version:
203
- recorded_at: Wed, 22 Jun 2016 16:08:43 GMT
195
+ recorded_at: Fri, 14 Aug 2020 08:21:42 GMT
204
196
  - request:
205
197
  method: post
206
- uri: https://api.chartmogul.com/v1/import/customers/cus_5417b49e-7ea8-474a-b6bc-5bbb406c15c0/invoices
198
+ uri: https://api.chartmogul.com/v1/import/customers/cus_2e010ebe-de07-11ea-a4dd-ff06789b4dcf/invoices
207
199
  body:
208
200
  encoding: UTF-8
209
- string: '{"invoices":[{"date":"2016-01-01 12:00:00 +0000","currency":"USD","line_items":[{"type":"subscription","subscription_external_id":"test_cus_sub_ext_id","subscription_set_external_id":"test_cus_set_ext_id","plan_uuid":"pl_209e4674-1258-4a35-8378-9b15c4086965","service_period_start":"2016-01-01
210
- 12:00:00 +0000","service_period_end":"2016-02-01 12:00:00 +0000","amount_in_cents":1000,"cancelled_at":"2016-01-15
211
- 12:00:00 +0000","prorated":false,"quantity":5,"discount_amount_in_cents":1200,"discount_code":"DISCCODE","tax_amount_in_cents":200,"external_id":"test_cus_li_ext_id"}],"transactions":[{"type":"payment","date":"2016-01-01
212
- 12:00:00 +0000","result":"successful","external_id":"test_cus_tr_ext_id"}],"external_id":"test_cus_inv_ext_id","due_date":"2016-01-07
213
- 12:00:00 +0000"}],"customer_uuid":"cus_5417b49e-7ea8-474a-b6bc-5bbb406c15c0"}'
201
+ string: '{"invoices":[{"date":"2016-01-01 12:00:00 UTC","currency":"USD","line_items":[{"type":"subscription","subscription_external_id":"test_cus_sub_ext_id","service_period_start":"2016-01-01
202
+ 12:00:00 UTC","service_period_end":"2016-02-01 12:00:00 UTC","amount_in_cents":1000,"cancelled_at":"2016-01-15
203
+ 12:00:00 UTC","prorated":false,"quantity":5,"discount_amount_in_cents":1200,"discount_code":"DISCCODE","tax_amount_in_cents":200,"external_id":"test_cus_li_ext_id","plan_uuid":"pl_2e010ebf-de07-11ea-a4dd-8bf0a8234993"}],"transactions":[{"type":"payment","date":"2016-01-01
204
+ 12:00:00 UTC","result":"successful","external_id":"test_cus_tr_ext_id"}],"external_id":"test_cus_inv_ext_id","customer_external_id":"test_cus_ext_id","due_date":"2016-01-07
205
+ 12:00:00 UTC"}],"customer_uuid":"cus_2e010ebe-de07-11ea-a4dd-ff06789b4dcf"}'
214
206
  headers:
215
207
  User-Agent:
216
- - Faraday v0.9.2
208
+ - Faraday v1.0.1
217
209
  Content-Type:
218
210
  - application/json
219
211
  Authorization:
220
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
212
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
221
213
  response:
222
214
  status:
223
215
  code: 201
224
- message:
216
+ message: Created
225
217
  headers:
226
218
  server:
227
- - nginx/1.9.10
219
+ - nginx/1.10.1
228
220
  date:
229
- - Wed, 22 Jun 2016 16:08:43 GMT
221
+ - Fri, 14 Aug 2020 08:21:43 GMT
230
222
  content-type:
231
223
  - application/json; charset=utf-8
232
224
  transfer-encoding:
233
225
  - chunked
234
226
  connection:
235
- - close
227
+ - keep-alive
228
+ status:
229
+ - 201 Created
236
230
  x-frame-options:
237
231
  - SAMEORIGIN
238
232
  x-xss-protection:
239
233
  - 1; mode=block
240
234
  x-content-type-options:
241
235
  - nosniff
236
+ x-download-options:
237
+ - noopen
238
+ x-permitted-cross-domain-policies:
239
+ - none
240
+ referrer-policy:
241
+ - strict-origin-when-cross-origin
242
242
  etag:
243
- - W/"95e16111eb07645d2ab5af2f762cc1a7"
243
+ - W/"2f2be4d16bccef7180e8df0515ebfd2f"
244
244
  cache-control:
245
245
  - max-age=0, private, must-revalidate
246
246
  x-request-id:
247
- - fcadbbb4-8984-4938-97b3-151a3efae3ce
247
+ - ccdcc2fb-0a04-4307-94c8-f8482ec6bd09
248
248
  x-runtime:
249
- - '0.182908'
249
+ - '1.437992'
250
250
  strict-transport-security:
251
251
  - max-age=15768000
252
252
  body:
253
253
  encoding: UTF-8
254
- string: '{"invoices":[{"uuid":"inv_a11675b0-f4cb-4d2b-8b38-492626ac373e","external_id":"test_cus_inv_ext_id","date":"2016-01-01T12:00:00.000Z","due_date":"2016-01-07T12:00:00.000Z","currency":"USD","line_items":[{"uuid":"li_6dc1a6bd-877d-4802-a595-4b0f5943bdfa","external_id":"test_cus_li_ext_id","type":"subscription","subscription_uuid":"sub_b39173f6-cd13-4c06-b6e6-0c659867439f","plan_uuid":"pl_209e4674-1258-4a35-8378-9b15c4086965","prorated":false,"service_period_start":"2016-01-01T12:00:00.000Z","service_period_end":"2016-02-01T12:00:00.000Z","amount_in_cents":1000,"quantity":5,"discount_code":"DISCCODE","discount_amount_in_cents":1200,"tax_amount_in_cents":200}],"transactions":[{"uuid":"tr_829db91c-8b46-48ac-805d-09d29afe64c2","external_id":"test_cus_tr_ext_id","type":"payment","date":"2016-01-01T12:00:00.000Z","result":"successful"}]}]}'
254
+ string: '{"invoices":[{"uuid":"inv_deb98a20-3e71-49df-a49a-ac9d29c004be","date":"2016-01-01T12:00:00.000Z","due_date":"2016-01-07T12:00:00.000Z","external_id":"test_cus_inv_ext_id","currency":"USD","line_items":[{"uuid":"li_ffa7fad8-c393-45d2-aec4-2a869ece67c5","external_id":"test_cus_li_ext_id","type":"subscription","subscription_uuid":"sub_f3fa6a4e-8fc8-4843-95f2-062bc17826c6","subscription_external_id":"test_cus_sub_ext_id","prorated":false,"service_period_start":"2016-01-01T12:00:00.000Z","service_period_end":"2016-02-01T12:00:00.000Z","plan_uuid":"pl_2e010ebf-de07-11ea-a4dd-8bf0a8234993","amount_in_cents":1000,"quantity":5,"discount_code":"DISCCODE","discount_amount_in_cents":1200,"tax_amount_in_cents":200,"transaction_fees_in_cents":0,"account_code":""}],"transactions":[{"uuid":"tr_ff121f19-ef39-4bc8-824e-225d1b33e5da","external_id":"test_cus_tr_ext_id","type":"payment","date":"2016-01-01T12:00:00.000Z","result":"successful"}]}]}'
255
255
  http_version:
256
- recorded_at: Wed, 22 Jun 2016 16:08:43 GMT
256
+ recorded_at: Fri, 14 Aug 2020 08:21:43 GMT
257
257
  - request:
258
258
  method: delete
259
- uri: https://api.chartmogul.com/v1/data_sources/ds_9fb17361-f24c-4c13-a25d-4c08fbc7132e
259
+ uri: https://api.chartmogul.com/v1/data_sources/ds_2db7bab6-de07-11ea-a4dd-7f82d51c3d05/customers/cus_2e010ebe-de07-11ea-a4dd-ff06789b4dcf/invoices
260
260
  body:
261
261
  encoding: US-ASCII
262
262
  string: ''
263
263
  headers:
264
264
  User-Agent:
265
- - Faraday v0.9.2
265
+ - Faraday v1.0.1
266
266
  Authorization:
267
- - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
267
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
268
268
  response:
269
269
  status:
270
270
  code: 204
271
- message:
271
+ message: No Content
272
272
  headers:
273
273
  server:
274
- - nginx/1.9.10
274
+ - nginx/1.10.1
275
275
  date:
276
- - Wed, 22 Jun 2016 16:08:43 GMT
276
+ - Fri, 14 Aug 2020 08:21:44 GMT
277
277
  connection:
278
- - close
278
+ - keep-alive
279
+ status:
280
+ - 204 No Content
279
281
  x-frame-options:
280
282
  - SAMEORIGIN
281
283
  x-xss-protection:
282
284
  - 1; mode=block
283
285
  x-content-type-options:
284
286
  - nosniff
287
+ x-download-options:
288
+ - noopen
289
+ x-permitted-cross-domain-policies:
290
+ - none
291
+ referrer-policy:
292
+ - strict-origin-when-cross-origin
285
293
  cache-control:
286
294
  - no-cache
287
295
  x-request-id:
288
- - 5f2bcbf4-0c81-435f-b168-49a245d4e2c9
296
+ - c03bcf86-5a42-4655-b015-76ffc653ec91
289
297
  x-runtime:
290
- - '0.018236'
298
+ - '0.353793'
291
299
  strict-transport-security:
292
300
  - max-age=15768000
293
301
  body:
294
302
  encoding: UTF-8
295
303
  string: ''
296
304
  http_version:
297
- recorded_at: Wed, 22 Jun 2016 16:08:43 GMT
298
- recorded_with: VCR 3.0.3
305
+ recorded_at: Fri, 14 Aug 2020 08:21:44 GMT
306
+ - request:
307
+ method: delete
308
+ uri: https://api.chartmogul.com/v1/data_sources/ds_2db7bab6-de07-11ea-a4dd-7f82d51c3d05
309
+ body:
310
+ encoding: US-ASCII
311
+ string: ''
312
+ headers:
313
+ User-Agent:
314
+ - Faraday v1.0.1
315
+ Authorization:
316
+ - Basic YjNjZTUxNTNkMDYyNmQwNjE3YWQ4OWQyMzQ2OTA1OTc6OGE0YTgyOTMwYTVhMjgzOTA3MDgwNGYzMTdmNTZjYjA=
317
+ response:
318
+ status:
319
+ code: 204
320
+ message: No Content
321
+ headers:
322
+ server:
323
+ - nginx/1.10.1
324
+ date:
325
+ - Fri, 14 Aug 2020 08:21:44 GMT
326
+ connection:
327
+ - keep-alive
328
+ status:
329
+ - 204 No Content
330
+ access-control-allow-credentials:
331
+ - 'true'
332
+ body:
333
+ encoding: UTF-8
334
+ string: ''
335
+ http_version:
336
+ recorded_at: Fri, 14 Aug 2020 08:21:44 GMT
337
+ recorded_with: VCR 5.1.0
@@ -35,7 +35,7 @@ http_interactions:
35
35
  body:
36
36
  encoding: UTF-8
37
37
  string: '{"entries":[{"id":16664702,"description":"purchased the Yael Cohen
38
- plan","activity-mrr-movement":10871,"activity-mrr":10871,"activity-arr":130452,"date":"2015-04-16T13:38:29+00:00","type":"new_biz","currency":"USD","currency-sign":"$"}],"has_more":false,"per_page":200,"page":1}'
38
+ plan","activity-mrr-movement":10871,"activity-mrr":10871,"activity-arr":130452,"date":"2015-04-16T13:38:29+00:00","type":"new_biz","currency":"USD","currency-sign":"$","subscription_external_id":"si_IJxVS1c1TjSB0s"}],"has_more":false,"per_page":200,"page":1}'
39
39
  http_version:
40
40
  recorded_at: Fri, 01 Jul 2016 14:47:49 GMT
41
41
  recorded_with: VCR 3.0.3
@@ -35,7 +35,7 @@ http_interactions:
35
35
  body:
36
36
  encoding: UTF-8
37
37
  string: '{"entries":[{"id":16664702,"description":"purchased the Yael Cohen
38
- plan","activity-mrr-movement":10871,"activity-mrr":10871,"activity-arr":130452,"date":"2015-04-16T13:38:29+00:00","type":"new_biz","currency":"USD","currency-sign":"$"}],"has_more":false,"per_page":200,"page":1}'
38
+ plan","activity-mrr-movement":10871,"activity-mrr":10871,"activity-arr":130452,"date":"2015-04-16T13:38:29+00:00","type":"new_biz","currency":"USD","currency-sign":"$","subscription_external_id":"si_IJxVS1c1TjSB0s"}],"has_more":false,"per_page":200,"page":1}'
39
39
  http_version:
40
40
  recorded_at: Fri, 01 Jul 2016 14:47:49 GMT
41
41
  recorded_with: VCR 3.0.3
@@ -73,11 +73,11 @@ require 'chartmogul/enrichment/customer'
73
73
  module ChartMogul
74
74
  API_BASE = 'https://api.chartmogul.com'
75
75
  MAX_RETRIES = 20
76
+ CONFIG_THREAD_KEY = 'chartmogul_ruby.config'
76
77
 
77
78
  class << self
78
79
  extend ConfigAttributes
79
80
 
80
- CONFIG_THREAD_KEY = 'chartmogul_ruby.config'
81
81
 
82
82
  def config
83
83
  Thread.current[CONFIG_THREAD_KEY] = ChartMogul::Configuration.new if Thread.current[CONFIG_THREAD_KEY].nil?
@@ -87,5 +87,6 @@ module ChartMogul
87
87
  config_accessor :account_token
88
88
  config_accessor :secret_key
89
89
  config_accessor :max_retries, MAX_RETRIES
90
+ config_accessor :api_base, API_BASE
90
91
  end
91
92
  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)
18
+ json = ChartMogul::Utils::JSONParser.parse(resp.body, skip_case_conversion: self.class.skip_case_conversion)
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)
33
+ json = ChartMogul::Utils::JSONParser.parse(resp.body, skip_case_conversion: skip_case_conversion)
34
34
 
35
35
  new_from_json(json)
36
36
  end
@@ -25,7 +25,7 @@ module ChartMogul
25
25
  req.body = JSON.dump(body_data)
26
26
  end
27
27
  end
28
- ChartMogul::Utils::JSONParser.parse(resp.body)
28
+ ChartMogul::Utils::JSONParser.parse(resp.body, skip_case_conversion: skip_case_conversion)
29
29
  end
30
30
 
31
31
  def custom!(http_method, http_path, body_data = {})
@@ -15,7 +15,7 @@ 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
+ json = ChartMogul::Utils::JSONParser.parse(resp.body, skip_case_conversion: skip_case_conversion)
19
19
  new_from_json(json)
20
20
  end
21
21
  end
@@ -15,7 +15,8 @@ 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)
18
+
19
+ json = ChartMogul::Utils::JSONParser.parse(resp.body, skip_case_conversion: self.class.skip_case_conversion)
19
20
 
20
21
  assign_all_attributes(json)
21
22
  end
@@ -30,7 +31,7 @@ module ChartMogul
30
31
  req.body = JSON.dump(resource.serialize_for_write)
31
32
  end
32
33
  end
33
- json = ChartMogul::Utils::JSONParser.parse(resp.body)
34
+ json = ChartMogul::Utils::JSONParser.parse(resp.body, skip_case_conversion: skip_case_conversion)
34
35
 
35
36
  new_from_json(json)
36
37
  end
@@ -17,7 +17,7 @@ module ChartMogul
17
17
  MAX_INTERVAL = 60
18
18
  THREAD_CONNECTION_KEY = 'chartmogul_ruby.api_resource.connection'
19
19
 
20
- class << self; attr_reader :resource_path, :resource_name, :resource_root_key end
20
+ class << self; attr_reader :resource_path, :resource_name, :resource_root_key, :skip_case_conversion end
21
21
 
22
22
  def self.set_resource_path(path)
23
23
  @resource_path = ChartMogul::ResourcePath.new(path)
@@ -31,13 +31,18 @@ module ChartMogul
31
31
  @resource_root_key = root_key
32
32
  end
33
33
 
34
+ # When true, response hash keys won't be converted to snake case
35
+ def self.set_skip_case_conversion(value)
36
+ @skip_case_conversion = value
37
+ end
38
+
34
39
  def self.connection
35
40
  Thread.current[THREAD_CONNECTION_KEY] ||= build_connection
36
41
  end
37
42
 
38
43
  def self.handling_errors
39
44
  yield
40
- rescue Faraday::ClientError => e
45
+ rescue Faraday::ClientError, Faraday::ServerError => e
41
46
  e.response ? handle_request_error(e) : handle_other_error(e)
42
47
  rescue StandardError => e
43
48
  handle_other_error(e)
@@ -80,13 +85,13 @@ module ChartMogul
80
85
  private
81
86
 
82
87
  def self.build_connection
83
- Faraday.new(url: ChartMogul::API_BASE) do |faraday|
88
+ Faraday.new(url: ChartMogul.api_base) do |faraday|
84
89
  faraday.use Faraday::Request::BasicAuthentication, ChartMogul.account_token, ChartMogul.secret_key
85
90
  faraday.use Faraday::Response::RaiseError
86
91
  faraday.request :retry, max: ChartMogul.max_retries, retry_statuses: RETRY_STATUSES,
87
92
  max_interval: MAX_INTERVAL, backoff_factor: BACKOFF_FACTOR,
88
93
  interval_randomness: INTERVAL_RANDOMNESS, interval: INTERVAL, exceptions: RETRY_EXCEPTIONS
89
- faraday.use Faraday::Adapter::NetHttp
94
+ faraday.adapter Faraday::Adapter::NetHttp
90
95
  end
91
96
  end
92
97
  end
@@ -5,5 +5,6 @@ module ChartMogul
5
5
  attr_accessor :account_token
6
6
  attr_accessor :secret_key
7
7
  attr_accessor :max_retries
8
+ attr_accessor :api_base
8
9
  end
9
10
  end
@@ -4,6 +4,7 @@ module ChartMogul
4
4
  class Customer < APIResource
5
5
  set_resource_name 'Customer'
6
6
  set_resource_path '/v1/customers'
7
+ set_skip_case_conversion true
7
8
 
8
9
  readonly_attr :uuid
9
10
  readonly_attr :id
@@ -26,6 +26,15 @@ module ChartMogul
26
26
  super(options.merge(customer_uuid: customer_uuid))
27
27
  end
28
28
 
29
+ def self.destroy_all!(data_source_uuid, customer_uuid)
30
+ path = ChartMogul::ResourcePath.new('v1/data_sources/:data_source_uuid/customers/:customer_uuid/invoices')
31
+ handling_errors do
32
+ connection.delete(path.apply(data_source_uuid: data_source_uuid, customer_uuid: customer_uuid))
33
+ end
34
+ true
35
+ end
36
+
37
+
29
38
  def_delegators :invoices, :each, :[], :<<, :size, :length, :empty?, :first
30
39
 
31
40
  private
@@ -12,6 +12,7 @@ module ChartMogul
12
12
  readonly_attr :activity_mrr_movement
13
13
  readonly_attr :currency
14
14
  readonly_attr :currency_sign
15
+ readonly_attr :subscription_external_id
15
16
 
16
17
  def self.all(customer_uuid, options = {})
17
18
  ChartMogul::Metrics::Activities.all(customer_uuid, options)
@@ -4,8 +4,10 @@ module ChartMogul
4
4
  module Utils
5
5
  class JSONParser
6
6
  class << self
7
- def parse(json_string)
7
+ def parse(json_string, skip_case_conversion: false)
8
8
  hash = JSON.parse(json_string, symbolize_names: true)
9
+ return hash if skip_case_conversion
10
+
9
11
  HashSnakeCaser.new(hash).to_snake_keys
10
12
  end
11
13
 
@@ -20,7 +22,15 @@ module ChartMogul
20
22
  def opt_string_to_time(value)
21
23
  return value unless value.instance_of?(String)
22
24
 
23
- Time.iso8601(value) rescue Time.rfc2822(value) rescue value
25
+ parse_timestamp(value)
26
+ rescue ArgumentError
27
+ value
28
+ end
29
+
30
+ def parse_timestamp(value)
31
+ Time.iso8601(value)
32
+ rescue ArgumentError
33
+ Time.rfc2822(value)
24
34
  end
25
35
  end
26
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChartMogul
4
- VERSION = '1.6.2'
4
+ VERSION = '1.6.8'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chartmogul-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Kopac
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-24 00:00:00.000000000 Z
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.17.3
19
+ version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.17.3
26
+ version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -171,6 +171,7 @@ executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
+ - ".DS_Store"
174
175
  - ".gitignore"
175
176
  - ".rspec"
176
177
  - ".travis.yml"
@@ -327,14 +328,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
328
  requirements:
328
329
  - - ">="
329
330
  - !ruby/object:Gem::Version
330
- version: '0'
331
+ version: '2.3'
331
332
  required_rubygems_version: !ruby/object:Gem::Requirement
332
333
  requirements:
333
334
  - - ">="
334
335
  - !ruby/object:Gem::Version
335
336
  version: '0'
336
337
  requirements: []
337
- rubygems_version: 3.0.8
338
+ rubygems_version: 3.1.4
338
339
  signing_key:
339
340
  specification_version: 4
340
341
  summary: Chartmogul API Ruby Client