chartmogul-ruby 1.6.6 → 1.6.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48f89ffb09ae87641ce72a86933370c44a34f9bdfc3007e3cd0757e7e3ab86fc
4
- data.tar.gz: 195daeabc4de7495673bf7a8066ac777743f2e52fe0c4d9a53e2e9562fec3c29
3
+ metadata.gz: 7217ec585904be468d9fc18d74c84a783803ca3d0bcf5e3e2f6f916012131a4f
4
+ data.tar.gz: d28cf68e49a9f7da6bb39cb2d1cb1fa49c93d9337296d87e1f96a9aa1b5daecd
5
5
  SHA512:
6
- metadata.gz: c64c9287441ba417ddb56276eb2b7e993dc0cc41ad7448960dbe6bc9c852d64bd7d022f41fe702cafc0493d02e7f3f72f0c63b6b3c5391921bc86333acb78000
7
- data.tar.gz: 16ef7f3cc9120ba2934979e4d3aa99b0b36ccfd42dc1d2018a3d2e650993cce5726706543200b718d7bfce233bbdf894be4ed67040859123d1dcae29df59fbba
6
+ metadata.gz: f0e1a312266b32b8a50309c92999f09047ad64f3de5539f7c468dd1b2d29ca47469322ef38ab1bcd19bd16c8aad175a018f0886129b1b64a2b2275ccfee79ca8
7
+ data.tar.gz: 66d4079794ddddba66de3236217fc432ccaeba90f338789e2d158d23c23e687f5cbd05f111498b977becde0497ade73d97a9659244bfc29ded921342fc27065e
@@ -1,5 +1,8 @@
1
1
  # chartmogul-ruby Change Log
2
2
 
3
+ ## Version 1.6.7 - 8 September 2020
4
+ - Allow adding Customer custom attributes in camel case
5
+
3
6
  ## Version 1.5.0 - 20 February 2020
4
7
  - Add support for plan groups API
5
8
 
@@ -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
@@ -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,6 +31,11 @@ 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
@@ -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
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChartMogul
4
- VERSION = '1.6.6'
4
+ VERSION = '1.6.7'
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.6
4
+ version: 1.6.7
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-08-19 00:00:00.000000000 Z
11
+ date: 2020-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday