recurly 3.2.1 → 3.2.2

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: 81648c1be2e9fb74eef222bfa82c1633a05293e689f26b5501776cf9c80529b7
4
- data.tar.gz: d8b7be78ba697a3a37a503e5c51416290ecadf070154149fb4b18b4083ee184a
3
+ metadata.gz: 1182927b43b3f1815fc6e5fbdc029e655d5310898044087cdaa297e53c3a13ce
4
+ data.tar.gz: 39fb2a708a7beba058967282ecd06a7713ed2ad62397ce86a73998fdc2f0542c
5
5
  SHA512:
6
- metadata.gz: 639c25cbd19d6b69425f96c642f639206a3bc4dd55319f810a2ca74aec88e4bccd5cfd65bb3e8a4df4913af6e298b271825f8e5b14e1daf062b02d9e916da48c
7
- data.tar.gz: d03648e2fad3942b812d3a156080a7b0ce944110692279aaaab0c27a9bbc8e52c4dfbb74a2d07047adbde447f1e4b6911ad6e2bd3a04d190f3662566e6e2f897
6
+ metadata.gz: 62e800e4c9ca3a1802f24bf46801e86e4bece4b462da4f362a49b8c6f93166ed5364cca83c6999b58fad38b3d5a175d6fc75f12d9d5e381b81410017f9c426e7
7
+ data.tar.gz: 4f5df171887b926abd2142d3b79f43beaee6ec4d17cb2481dfc374a4dbab59b4122fc7df3a7216a7f4ca1b9d1f44080054f3aca47f56c2a379da18d7dd20f342
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 3.2.1
2
+ current_version = 3.2.2
3
3
  parse = (?P<major>\d+)
4
4
  \.(?P<minor>\d+)
5
5
  \.(?P<patch>\d+)
@@ -126,14 +126,14 @@ module Recurly
126
126
  response = HTTP::Response.new(faraday_resp, request)
127
127
  raise_api_error!(response) unless (200...300).include?(response.status)
128
128
  resource = if response.body
129
- if BINARY_TYPES.include?(response.content_type)
130
- FileParser.parse(response.body)
131
- else
132
- JSONParser.parse(self, response.body)
133
- end
134
- else
135
- Resources::Empty.new
136
- end
129
+ if BINARY_TYPES.include?(response.content_type)
130
+ FileParser.parse(response.body)
131
+ else
132
+ JSONParser.parse(self, response.body)
133
+ end
134
+ else
135
+ Resources::Empty.new
136
+ end
137
137
  # Keep this interface "private"
138
138
  resource.instance_variable_set(:@response, response)
139
139
  resource
@@ -141,15 +141,15 @@ module Recurly
141
141
 
142
142
  def raise_network_error!(ex)
143
143
  error_class = case ex
144
- when Faraday::TimeoutError
145
- Errors::TimeoutError
146
- when Faraday::ConnectionFailed
147
- Errors::ConnectionFailedError
148
- when Faraday::SSLError
149
- Errors::SSLError
150
- else
151
- Errors::NetworkError
152
- end
144
+ when Faraday::TimeoutError
145
+ Errors::TimeoutError
146
+ when Faraday::ConnectionFailed
147
+ Errors::ConnectionFailedError
148
+ when Faraday::SSLError
149
+ Errors::SSLError
150
+ else
151
+ Errors::NetworkError
152
+ end
153
153
 
154
154
  raise error_class, ex.message
155
155
  end
@@ -27,10 +27,10 @@ module Recurly
27
27
  # @return [Error,Resource]
28
28
  def self.from_json(data)
29
29
  type = if data.has_key?("error")
30
- "error_may_have_transaction"
31
- else
32
- data["object"]
33
- end
30
+ "error_may_have_transaction"
31
+ else
32
+ data["object"]
33
+ end
34
34
  klazz = self.recurly_class(type)
35
35
 
36
36
  unless klazz
@@ -35,20 +35,20 @@ module Recurly
35
35
  data.each do |k, v|
36
36
  schema_attr = schema.get_attribute(k)
37
37
  norm_val = if v.respond_to?(:attributes)
38
- cast_request(v, v.class.schema)
39
- elsif v.is_a?(Array)
40
- v.map do |elem|
41
- if elem.respond_to?(:attributes)
42
- cast_request(elem, elem.class.schema)
43
- else
44
- elem
45
- end
46
- end
47
- elsif v.is_a?(Hash) && schema_attr && schema_attr.is_a?(Schema::ResourceAttribute)
48
- cast_request(v, schema_attr.recurly_class.schema)
49
- else
50
- v
51
- end
38
+ cast_request(v, v.class.schema)
39
+ elsif v.is_a?(Array)
40
+ v.map do |elem|
41
+ if elem.respond_to?(:attributes)
42
+ cast_request(elem, elem.class.schema)
43
+ else
44
+ elem
45
+ end
46
+ end
47
+ elsif v.is_a?(Hash) && schema_attr && schema_attr.is_a?(Schema::ResourceAttribute)
48
+ cast_request(v, schema_attr.recurly_class.schema)
49
+ else
50
+ v
51
+ end
52
52
 
53
53
  casted[k] = norm_val
54
54
  end
@@ -23,15 +23,15 @@ module Recurly
23
23
 
24
24
  if schema_attr
25
25
  val = if val.nil?
26
- val
27
- elsif schema_attr.is_valid?(val)
28
- schema_attr.cast(val)
29
- else
30
- if Recurly::STRICT_MODE
31
- msg = "#{self.class}##{attr_name} does not have the right type. Value: #{val.inspect} was expected to be a #{schema_attr}"
32
- raise ArgumentError, msg
33
- end
34
- end
26
+ val
27
+ elsif schema_attr.is_valid?(val)
28
+ schema_attr.cast(val)
29
+ else
30
+ if Recurly::STRICT_MODE
31
+ msg = "#{self.class}##{attr_name} does not have the right type. Value: #{val.inspect} was expected to be a #{schema_attr}"
32
+ raise ArgumentError, msg
33
+ end
34
+ end
35
35
 
36
36
  writer = "#{attr_name}="
37
37
  resource.send(writer, val)
@@ -39,11 +39,11 @@ module Recurly
39
39
  # will take care of it for us
40
40
  unless safely_castable?(val.class, schema_attr.type)
41
41
  expected = case schema_attr
42
- when Schema::ArrayAttribute
43
- "Array of #{schema_attr.type}s"
44
- else
45
- schema_attr.type
46
- end
42
+ when Schema::ArrayAttribute
43
+ "Array of #{schema_attr.type}s"
44
+ else
45
+ schema_attr.type
46
+ end
47
47
 
48
48
  raise ArgumentError, "Attribute '#{name}' on the resource #{self.class.name} is type #{val.class} but should be a #{expected}"
49
49
  end
@@ -73,10 +73,10 @@ module Recurly
73
73
  def safely_castable?(from_type, to_type)
74
74
  # TODO we can drop this switch when 2.3 support is dropped
75
75
  int_class = if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.0")
76
- :Integer
77
- else
78
- :Fixnum
79
- end
76
+ :Integer
77
+ else
78
+ :Fixnum
79
+ end
80
80
  int_class = Kernel.const_get(int_class)
81
81
 
82
82
  case [from_type, to_type]
@@ -1,3 +1,3 @@
1
1
  module Recurly
2
- VERSION = "3.2.1"
2
+ VERSION = "3.2.2"
3
3
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_dependency "faraday", ">= 0.8.11", "< 0.16"
24
+ spec.add_dependency "faraday", ">= 0.8.11", "< 1.0.0"
25
25
 
26
26
  spec.add_development_dependency "net-http-persistent", "~> 2.9.4"
27
27
  spec.add_development_dependency "bundler", "~> 2.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-10 00:00:00.000000000 Z
11
+ date: 2020-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 0.8.11
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '0.16'
22
+ version: 1.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 0.8.11
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '0.16'
32
+ version: 1.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: net-http-persistent
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -315,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  - !ruby/object:Gem::Version
316
316
  version: '0'
317
317
  requirements: []
318
- rubygems_version: 3.0.3
318
+ rubygems_version: 3.0.6
319
319
  signing_key:
320
320
  specification_version: 4
321
321
  summary: The ruby client for Recurly's V3 API