iron_bank 5.2.3 → 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: 1e37b6edaf23f3f2c56ad899f5e22e5417080acf0f6af49b3e844f4b08403032
4
- data.tar.gz: 41a4709d82e6e8d7a26dd6864a33f0872dfd41a28552276bb15a6f0ee2028dc1
3
+ metadata.gz: 318930655ab8662b1aff972445f64db04b8d4a728bdd99efca68d7959be3ec2e
4
+ data.tar.gz: b70938147156d35cb100143d31c671af3273fc3d4615ed304eea335c0431e7c2
5
5
  SHA512:
6
- metadata.gz: 595e9e90dd0e01cad19051c3e4c1b283aec74a45e61c4629fc84f2628e4c508acc205761a717f77ca92b06ddc1df7b414e91cb1b440afba58c17b9a1e4dbe14b
7
- data.tar.gz: 68ad911c800be46ddd923ad5d660c173439dba05d1e45234ebe325c997126ccc480b04c82c3e4bc0c1c7ff2c294873c7f1c1f5b94110ae3651ce01d91354673e
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.3)
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,33 +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.4.3)
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)
33
+ faraday-multipart (~> 1.0)
32
34
  faraday-net_http (~> 1.0)
33
- faraday-net_http_persistent (~> 1.1)
34
- multipart-post (>= 1.2, < 3)
35
+ faraday-net_http_persistent (~> 1.0)
36
+ faraday-patron (~> 1.0)
37
+ faraday-rack (~> 1.0)
38
+ faraday-retry (~> 1.0)
35
39
  ruby2_keywords (>= 0.0.4)
36
40
  faraday-em_http (1.0.0)
37
41
  faraday-em_synchrony (1.0.0)
38
42
  faraday-excon (1.1.0)
43
+ faraday-httpclient (1.0.1)
44
+ faraday-multipart (1.0.4)
45
+ multipart-post (~> 2)
39
46
  faraday-net_http (1.0.1)
40
- faraday-net_http_persistent (1.1.0)
41
- faraday_middleware (1.0.0)
47
+ faraday-net_http_persistent (1.2.0)
48
+ faraday-patron (1.0.0)
49
+ faraday-rack (1.0.0)
50
+ faraday-retry (1.0.3)
51
+ faraday_middleware (1.2.0)
42
52
  faraday (~> 1.0)
43
53
  i18n (1.8.7)
44
54
  concurrent-ruby (~> 1.0)
45
55
  kwalify (0.7.2)
46
56
  method_source (1.0.0)
47
- mini_portile2 (2.5.3)
57
+ mini_portile2 (2.8.0)
48
58
  minitest (5.14.3)
49
- multipart-post (2.1.1)
50
- nokogiri (1.11.7)
51
- mini_portile2 (~> 2.5.0)
59
+ multipart-post (2.2.3)
60
+ nokogiri (1.13.6)
61
+ mini_portile2 (~> 2.8.0)
52
62
  racc (~> 1.4)
53
- parallel (1.20.1)
54
- parser (3.0.0.0)
63
+ parallel (1.22.1)
64
+ parser (3.0.3.2)
55
65
  ast (~> 2.4.1)
56
66
  pry (0.13.1)
57
67
  coderay (~> 1.1)
@@ -60,16 +70,16 @@ GEM
60
70
  byebug (~> 11.0)
61
71
  pry (~> 0.13.0)
62
72
  psych (3.3.0)
63
- racc (1.5.2)
64
- rainbow (3.0.0)
73
+ racc (1.6.0)
74
+ rainbow (3.1.1)
65
75
  rake (13.0.3)
66
76
  reek (6.0.3)
67
77
  kwalify (~> 0.7.0)
68
78
  parser (~> 3.0.0)
69
79
  psych (~> 3.1)
70
80
  rainbow (>= 2.0, < 4.0)
71
- regexp_parser (2.0.3)
72
- rexml (3.2.4)
81
+ regexp_parser (2.5.0)
82
+ rexml (3.2.5)
73
83
  rspec (3.10.0)
74
84
  rspec-core (~> 3.10.0)
75
85
  rspec-expectations (~> 3.10.0)
@@ -83,22 +93,22 @@ GEM
83
93
  diff-lcs (>= 1.2.0, < 2.0)
84
94
  rspec-support (~> 3.10.0)
85
95
  rspec-support (3.10.1)
86
- rubocop (1.8.1)
96
+ rubocop (1.24.1)
87
97
  parallel (~> 1.10)
88
98
  parser (>= 3.0.0.0)
89
99
  rainbow (>= 2.2.2, < 4.0)
90
100
  regexp_parser (>= 1.8, < 3.0)
91
101
  rexml
92
- rubocop-ast (>= 1.2.0, < 2.0)
102
+ rubocop-ast (>= 1.15.1, < 2.0)
93
103
  ruby-progressbar (~> 1.7)
94
104
  unicode-display_width (>= 1.4.0, < 3.0)
95
- rubocop-ast (1.4.0)
96
- parser (>= 2.7.1.5)
105
+ rubocop-ast (1.15.2)
106
+ parser (>= 3.0.1.1)
97
107
  rubocop-performance (1.9.2)
98
108
  rubocop (>= 0.90.0, < 2.0)
99
109
  rubocop-ast (>= 0.4.0)
100
110
  ruby-progressbar (1.11.0)
101
- ruby2_keywords (0.0.4)
111
+ ruby2_keywords (0.0.5)
102
112
  shoulda-matchers (4.5.0)
103
113
  activesupport (>= 4.2.0)
104
114
  simplecov (0.21.2)
@@ -107,10 +117,10 @@ GEM
107
117
  simplecov_json_formatter (~> 0.1)
108
118
  simplecov-html (0.12.3)
109
119
  simplecov_json_formatter (0.1.2)
110
- timecop (0.9.2)
120
+ timecop (0.9.5)
111
121
  tzinfo (2.0.4)
112
122
  concurrent-ruby (~> 1.0)
113
- unicode-display_width (2.0.0)
123
+ unicode-display_width (2.1.0)
114
124
  zeitwerk (2.4.2)
115
125
 
116
126
  PLATFORMS
@@ -124,13 +134,13 @@ DEPENDENCIES
124
134
  iron_bank!
125
135
  pry-byebug (~> 3.4)
126
136
  rake (~> 13.0)
127
- reek (~> 6.0)
128
- rspec (~> 3.0)
129
- rubocop (~> 1.0)
130
- rubocop-performance (~> 1.0)
131
- shoulda-matchers (~> 4.0)
132
- simplecov (~> 0.15)
137
+ reek (~> 6)
138
+ rspec (~> 3)
139
+ rubocop (~> 1)
140
+ rubocop-performance (~> 1)
141
+ shoulda-matchers (~> 4)
142
+ simplecov (~> 0.21)
133
143
  timecop (~> 0.9)
134
144
 
135
145
  BUNDLED WITH
136
- 2.2.21
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
@@ -56,6 +56,16 @@ module IronBank
56
56
  @query_fields ||= fields.select(&:selectable?).map(&:name)
57
57
  end
58
58
 
59
+ def query_custom_fields
60
+ @query_custom_fields ||= begin
61
+ custom_fields = fields.select do |field|
62
+ field.selectable? && field.custom?
63
+ end
64
+
65
+ custom_fields.map(&:name)
66
+ end
67
+ end
68
+
59
69
  def related
60
70
  @related ||= doc.xpath(".//related-objects/object").map do |node|
61
71
  IronBank::Describe::Related.from_xml(node)
@@ -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
@@ -31,6 +31,12 @@ module IronBank
31
31
  @query_fields ||= schema.query_fields - excluded_fields
32
32
  end
33
33
 
34
+ def query_custom_fields
35
+ return [] unless schema
36
+
37
+ @query_custom_fields ||= schema.query_custom_fields - excluded_fields
38
+ end
39
+
34
40
  def schema
35
41
  @schema ||= IronBank::Schema.for(object_name)
36
42
  end
@@ -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.3"
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.3
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-06-30 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.