iron_bank 5.2.6 → 5.3.0

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: fb169ea35186a7d6482c311a01110bfbe6c1ac2197e316d35cf5820f25a0ecdc
4
- data.tar.gz: f3c8c2b9a6499d17b85a9f8e3de4f9209c025417901a37990e98e969a34d79a8
3
+ metadata.gz: 318930655ab8662b1aff972445f64db04b8d4a728bdd99efca68d7959be3ec2e
4
+ data.tar.gz: b70938147156d35cb100143d31c671af3273fc3d4615ed304eea335c0431e7c2
5
5
  SHA512:
6
- metadata.gz: 87e2b2a5898135c34bcb153033fd19832977f25c231fa7ad28e49ca646a339ba8fcafefcb23fc647ec404314524ccb46257deb98f3b1f646925a4de9a8a51960
7
- data.tar.gz: db5459c331160c2e260ee35443a5e7ebdbb86f4a217160f5a55a583b5d32c1ba83701085f2c1cd1e02e2d043ba31fa292ff34b48bc93ca7417d0bf761e0cdee3
6
+ metadata.gz: 57048f30a2514b52da75fa8269d4c29dc80ae490153bd86999ece894eac442b583780adb5d66a0b0b39d9eeb9e0f3f9997b479a6729215f2f18847c8cea00b34
7
+ data.tar.gz: fe64468e0f79b085ccbde1fbd1f90d483fb23ec52fafdf8e1adface0f13b98b6af23fa3b262a49a34132f7da3ffcd233b9ff73c7d607cc61d1eb4cfd63670d49
@@ -15,7 +15,6 @@ jobs:
15
15
  strategy:
16
16
  matrix:
17
17
  ruby:
18
- - 2.5
19
18
  - 2.6
20
19
  - 2.7
21
20
  - 3.0
data/.reek.yml CHANGED
@@ -19,6 +19,7 @@ detectors:
19
19
  - IronBank::Configuration#middlewares
20
20
  - IronBank::Configuration#schema_directory
21
21
  - IronBank::Configuration#users_file
22
+ - IronBank::Configuration#api_minor_version
22
23
 
23
24
  BooleanParameter:
24
25
  exclude:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.8
1
+ 2.6.7
data/Gemfile CHANGED
@@ -11,10 +11,10 @@ gem "dotenv", "~> 2.2"
11
11
  gem "factory_bot", "~> 6.0"
12
12
  gem "pry-byebug", "~> 3.4"
13
13
  gem "rake", "~> 13.0"
14
- gem "reek", "~> 6.0"
15
- gem "rspec", "~> 3.0"
16
- gem "rubocop", "~> 1.0"
17
- gem "rubocop-performance", "~> 1.0"
18
- gem "shoulda-matchers", "~> 4.0"
19
- gem "simplecov", "~> 0.15"
14
+ gem "reek", "~> 6"
15
+ gem "rspec", "~> 3"
16
+ gem "rubocop", "~> 1"
17
+ gem "rubocop-performance", "~> 1"
18
+ gem "shoulda-matchers", "~> 4"
19
+ gem "simplecov", "~> 0.21"
20
20
  gem "timecop", "~> 0.9"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iron_bank (5.2.6)
4
+ iron_bank (5.3.0)
5
5
  faraday (~> 1)
6
6
  faraday_middleware (~> 1)
7
7
  nokogiri (~> 1)
@@ -15,7 +15,7 @@ GEM
15
15
  minitest (>= 5.1)
16
16
  tzinfo (~> 2.0)
17
17
  zeitwerk (~> 2.3)
18
- ast (2.4.1)
18
+ ast (2.4.2)
19
19
  bump (0.10.0)
20
20
  byebug (11.1.3)
21
21
  coderay (1.1.3)
@@ -25,39 +25,43 @@ GEM
25
25
  dotenv (2.7.6)
26
26
  factory_bot (6.1.0)
27
27
  activesupport (>= 5.0.0)
28
- faraday (1.8.0)
28
+ faraday (1.10.0)
29
29
  faraday-em_http (~> 1.0)
30
30
  faraday-em_synchrony (~> 1.0)
31
31
  faraday-excon (~> 1.1)
32
- faraday-httpclient (~> 1.0.1)
32
+ faraday-httpclient (~> 1.0)
33
+ faraday-multipart (~> 1.0)
33
34
  faraday-net_http (~> 1.0)
34
- faraday-net_http_persistent (~> 1.1)
35
+ faraday-net_http_persistent (~> 1.0)
35
36
  faraday-patron (~> 1.0)
36
37
  faraday-rack (~> 1.0)
37
- multipart-post (>= 1.2, < 3)
38
+ faraday-retry (~> 1.0)
38
39
  ruby2_keywords (>= 0.0.4)
39
40
  faraday-em_http (1.0.0)
40
41
  faraday-em_synchrony (1.0.0)
41
42
  faraday-excon (1.1.0)
42
43
  faraday-httpclient (1.0.1)
44
+ faraday-multipart (1.0.4)
45
+ multipart-post (~> 2)
43
46
  faraday-net_http (1.0.1)
44
47
  faraday-net_http_persistent (1.2.0)
45
48
  faraday-patron (1.0.0)
46
49
  faraday-rack (1.0.0)
47
- faraday_middleware (1.1.0)
50
+ faraday-retry (1.0.3)
51
+ faraday_middleware (1.2.0)
48
52
  faraday (~> 1.0)
49
53
  i18n (1.8.7)
50
54
  concurrent-ruby (~> 1.0)
51
55
  kwalify (0.7.2)
52
56
  method_source (1.0.0)
53
- mini_portile2 (2.6.1)
57
+ mini_portile2 (2.8.0)
54
58
  minitest (5.14.3)
55
- multipart-post (2.1.1)
56
- nokogiri (1.12.5)
57
- mini_portile2 (~> 2.6.1)
59
+ multipart-post (2.2.3)
60
+ nokogiri (1.13.6)
61
+ mini_portile2 (~> 2.8.0)
58
62
  racc (~> 1.4)
59
- parallel (1.20.1)
60
- parser (3.0.0.0)
63
+ parallel (1.22.1)
64
+ parser (3.0.3.2)
61
65
  ast (~> 2.4.1)
62
66
  pry (0.13.1)
63
67
  coderay (~> 1.1)
@@ -66,16 +70,16 @@ GEM
66
70
  byebug (~> 11.0)
67
71
  pry (~> 0.13.0)
68
72
  psych (3.3.0)
69
- racc (1.5.2)
70
- rainbow (3.0.0)
73
+ racc (1.6.0)
74
+ rainbow (3.1.1)
71
75
  rake (13.0.3)
72
76
  reek (6.0.3)
73
77
  kwalify (~> 0.7.0)
74
78
  parser (~> 3.0.0)
75
79
  psych (~> 3.1)
76
80
  rainbow (>= 2.0, < 4.0)
77
- regexp_parser (2.0.3)
78
- rexml (3.2.4)
81
+ regexp_parser (2.5.0)
82
+ rexml (3.2.5)
79
83
  rspec (3.10.0)
80
84
  rspec-core (~> 3.10.0)
81
85
  rspec-expectations (~> 3.10.0)
@@ -89,17 +93,17 @@ GEM
89
93
  diff-lcs (>= 1.2.0, < 2.0)
90
94
  rspec-support (~> 3.10.0)
91
95
  rspec-support (3.10.1)
92
- rubocop (1.8.1)
96
+ rubocop (1.24.1)
93
97
  parallel (~> 1.10)
94
98
  parser (>= 3.0.0.0)
95
99
  rainbow (>= 2.2.2, < 4.0)
96
100
  regexp_parser (>= 1.8, < 3.0)
97
101
  rexml
98
- rubocop-ast (>= 1.2.0, < 2.0)
102
+ rubocop-ast (>= 1.15.1, < 2.0)
99
103
  ruby-progressbar (~> 1.7)
100
104
  unicode-display_width (>= 1.4.0, < 3.0)
101
- rubocop-ast (1.4.0)
102
- parser (>= 2.7.1.5)
105
+ rubocop-ast (1.15.2)
106
+ parser (>= 3.0.1.1)
103
107
  rubocop-performance (1.9.2)
104
108
  rubocop (>= 0.90.0, < 2.0)
105
109
  rubocop-ast (>= 0.4.0)
@@ -113,10 +117,10 @@ GEM
113
117
  simplecov_json_formatter (~> 0.1)
114
118
  simplecov-html (0.12.3)
115
119
  simplecov_json_formatter (0.1.2)
116
- timecop (0.9.2)
120
+ timecop (0.9.5)
117
121
  tzinfo (2.0.4)
118
122
  concurrent-ruby (~> 1.0)
119
- unicode-display_width (2.0.0)
123
+ unicode-display_width (2.1.0)
120
124
  zeitwerk (2.4.2)
121
125
 
122
126
  PLATFORMS
@@ -130,13 +134,13 @@ DEPENDENCIES
130
134
  iron_bank!
131
135
  pry-byebug (~> 3.4)
132
136
  rake (~> 13.0)
133
- reek (~> 6.0)
134
- rspec (~> 3.0)
135
- rubocop (~> 1.0)
136
- rubocop-performance (~> 1.0)
137
- shoulda-matchers (~> 4.0)
138
- simplecov (~> 0.15)
137
+ reek (~> 6)
138
+ rspec (~> 3)
139
+ rubocop (~> 1)
140
+ rubocop-performance (~> 1)
141
+ shoulda-matchers (~> 4)
142
+ simplecov (~> 0.21)
139
143
  timecop (~> 0.9)
140
144
 
141
145
  BUNDLED WITH
142
- 2.2.26
146
+ 2.3.16
data/README.md CHANGED
@@ -13,7 +13,7 @@ This gem provides opinionated resources to interact with the Zuora API through
13
13
  their REST interface. It defines **associations** between them, as well as a
14
14
  simple **declaration API** (`with_one`, `with_many`) to extend them.
15
15
 
16
- This gem is tested against Ruby `>= 2.5`.
16
+ This gem is tested against Ruby `>= 2.6`.
17
17
 
18
18
  Please use [GitHub Issues][issues] to report bugs.
19
19
 
data/Rakefile CHANGED
@@ -33,7 +33,7 @@ task :excluded_fields, [:filename] do |_t, args|
33
33
  destination = args[:filename] || IronBank.configuration.excluded_fields_file
34
34
  fields = IronBank::Schema.excluded_fields.sort.to_h
35
35
 
36
- File.open(destination, "w") { |file| file.write(Psych.dump(fields)) }
36
+ File.write(destination, Psych.dump(fields))
37
37
  end
38
38
 
39
39
  # Helper function to set up an `IronBank::Client` instance
data/iron_bank.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  "mturan@zendesk.com"
20
20
  ]
21
21
 
22
- spec.required_ruby_version = ">= 2.5"
22
+ spec.required_ruby_version = ">= 2.6"
23
23
 
24
24
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
25
  f.match(%r{^(test|spec|features)/})
@@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "faraday", "~> 1"
33
33
  spec.add_dependency "faraday_middleware", "~> 1"
34
34
  spec.add_dependency "nokogiri", "~> 1"
35
+ spec.metadata["rubygems_mfa_required"] = "true"
35
36
  end
@@ -39,13 +39,11 @@ module IronBank
39
39
  end
40
40
 
41
41
  def response_object
42
- @response_object ||= begin
43
- if body.is_a?(Array)
44
- ::IronBank::Object.new(body.first).deep_underscore
45
- else
46
- {}
47
- end
48
- end
42
+ @response_object ||= if body.is_a?(Array)
43
+ ::IronBank::Object.new(body.first).deep_underscore
44
+ else
45
+ {}
46
+ end
49
47
  end
50
48
 
51
49
  def errors
@@ -9,7 +9,7 @@ module IronBank
9
9
  private
10
10
 
11
11
  def params
12
- { 'queryLocator': args }
12
+ { queryLocator: args }
13
13
  end
14
14
 
15
15
  # NOTE: Zuora API endpoint is case-sensitive.
@@ -99,7 +99,11 @@ module IronBank
99
99
  end
100
100
 
101
101
  def headers
102
- { "Content-Type" => "application/json" }.merge(auth.header)
102
+ config = IronBank.configuration
103
+ auth.header.reverse_merge(
104
+ "Content-Type" => "application/json",
105
+ "zuora-version" => config.api_minor_version
106
+ )
103
107
  end
104
108
 
105
109
  def reset_connection
@@ -12,7 +12,8 @@ module IronBank
12
12
  :empty?,
13
13
  :length,
14
14
  :map,
15
- :size
15
+ :size,
16
+ :to_ary
16
17
 
17
18
  def initialize(klass, conditions, records)
18
19
  @klass = klass
@@ -37,12 +37,16 @@ module IronBank
37
37
  # File path for Zuora users export
38
38
  attr_accessor :users_file
39
39
 
40
+ # Specify a minor version
41
+ attr_accessor :api_minor_version
42
+
40
43
  def initialize
41
- @schema_directory = "./config/schema"
42
- @export_directory = "./config/export"
43
- @logger = IronBank::Logger.new
44
- @auth_type = "token"
45
- @middlewares = []
44
+ @schema_directory = "./config/schema"
45
+ @export_directory = "./config/export"
46
+ @logger = IronBank::Logger.new
47
+ @auth_type = "token"
48
+ @middlewares = []
49
+ @api_minor_version = "211.0"
46
50
  end
47
51
 
48
52
  def schema_directory=(value)
@@ -94,10 +98,8 @@ module IronBank
94
98
  return {}
95
99
  end
96
100
 
97
- @excluded_fields ||= begin
98
- Psych.load_file(excluded_fields_file).tap do |fields|
99
- raise "Excluded fields must be a hash" unless fields.is_a?(Hash)
100
- end
101
+ @excluded_fields ||= Psych.load_file(excluded_fields_file).tap do |fields|
102
+ raise "Excluded fields must be a hash" unless fields.is_a?(Hash)
101
103
  end
102
104
  end
103
105
  end
@@ -6,20 +6,18 @@ module IronBank
6
6
  # Returns the appropriate IronBank::Error subclass based on status and
7
7
  # response message
8
8
  def self.from_response(response)
9
- klass = begin
10
- case response.status
11
- when 200 then from_body(response)
12
- when 400 then IronBank::BadRequestError
13
- when 401 then IronBank::UnauthorizedError
14
- when 404 then IronBank::NotFoundError
15
- when 422 then IronBank::UnprocessableEntityError
16
- when 429 then IronBank::TooManyRequestsError
17
- when 500 then IronBank::InternalServerError
18
- when 400..499 then IronBank::ClientError
19
- when 500..599 then IronBank::ServerError
20
- else IronBank::Error
21
- end
22
- end
9
+ klass = case response.status
10
+ when 200 then from_body(response)
11
+ when 400 then IronBank::BadRequestError
12
+ when 401 then IronBank::UnauthorizedError
13
+ when 404 then IronBank::NotFoundError
14
+ when 422 then IronBank::UnprocessableEntityError
15
+ when 429 then IronBank::TooManyRequestsError
16
+ when 500 then IronBank::InternalServerError
17
+ when 400..499 then IronBank::ClientError
18
+ when 500..599 then IronBank::ServerError
19
+ else IronBank::Error
20
+ end
23
21
 
24
22
  klass&.new(response)
25
23
  end
@@ -28,9 +28,11 @@ module IronBank
28
28
  sleep backoff_time
29
29
  end
30
30
 
31
+ # rubocop:disable Style/FileWrite
31
32
  File.open(file_path, "w") do |file|
32
33
  file.write(export.content.force_encoding("UTF-8"))
33
34
  end
35
+ # rubocop:enable Style/FileWrite
34
36
  end
35
37
 
36
38
  private
@@ -39,11 +39,9 @@ module IronBank
39
39
  end
40
40
 
41
41
  def self.excluded_fields
42
- @excluded_fields ||= begin
43
- IronBank::Resources.constants.each.with_object({}) do |resource, fields|
44
- fields[resource.to_s] =
45
- IronBank::Describe::ExcludedFields.call(object_name: resource)
46
- end
42
+ @excluded_fields ||= IronBank::Resources.constants.each.with_object({}) do |resource, fields|
43
+ fields[resource.to_s] =
44
+ IronBank::Describe::ExcludedFields.call(object_name: resource)
47
45
  end
48
46
  end
49
47
 
@@ -16,14 +16,12 @@ module IronBank
16
16
  def store
17
17
  return {} unless users_file
18
18
 
19
- @store ||= begin
20
- if File.exist?(users_file)
21
- load_records
22
- else
23
- IronBank.logger.warn "File does not exist: #{users_file}"
24
- {}
25
- end
26
- end
19
+ @store ||= if File.exist?(users_file)
20
+ load_records
21
+ else
22
+ IronBank.logger.warn "File does not exist: #{users_file}"
23
+ {}
24
+ end
27
25
  end
28
26
 
29
27
  def load_records
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IronBank
4
- VERSION = "5.2.6"
4
+ VERSION = "5.3.0"
5
5
  API_VERSION = "v1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_bank
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.6
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickael Pham
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-10-12 00:00:00.000000000 Z
14
+ date: 2022-06-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -154,7 +154,8 @@ files:
154
154
  homepage: https://github.com/zendesk/iron_bank
155
155
  licenses:
156
156
  - Apache-2.0
157
- metadata: {}
157
+ metadata:
158
+ rubygems_mfa_required: 'true'
158
159
  post_install_message:
159
160
  rdoc_options: []
160
161
  require_paths:
@@ -163,15 +164,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
164
  requirements:
164
165
  - - ">="
165
166
  - !ruby/object:Gem::Version
166
- version: '2.5'
167
+ version: '2.6'
167
168
  required_rubygems_version: !ruby/object:Gem::Requirement
168
169
  requirements:
169
170
  - - ">="
170
171
  - !ruby/object:Gem::Version
171
172
  version: '0'
172
173
  requirements: []
173
- rubyforge_project:
174
- rubygems_version: 2.7.6.2
174
+ rubygems_version: 3.0.3.1
175
175
  signing_key:
176
176
  specification_version: 4
177
177
  summary: An opinionated Ruby interface to the Zuora API.