iron_bank 5.2.6 → 5.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +40 -33
- data/.github/workflows/ruby-gem-publication.yml +12 -0
- data/.reek.yml +1 -0
- data/.rubocop.yml +1 -0
- data/.ruby-version +1 -1
- data/Gemfile +6 -6
- data/Gemfile.lock +71 -69
- data/README.md +1 -1
- data/Rakefile +5 -5
- data/bin/console +5 -5
- data/iron_bank.gemspec +2 -1
- data/lib/iron_bank/action.rb +5 -7
- data/lib/iron_bank/actions/query_more.rb +1 -1
- data/lib/iron_bank/client.rb +5 -1
- data/lib/iron_bank/collection.rb +2 -1
- data/lib/iron_bank/configuration.rb +11 -9
- data/lib/iron_bank/error.rb +12 -14
- data/lib/iron_bank/local_records.rb +3 -1
- data/lib/iron_bank/query_builder.rb +1 -1
- data/lib/iron_bank/schema.rb +4 -6
- data/lib/iron_bank/user.rb +6 -8
- data/lib/iron_bank/version.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 853859a45aaabdcfc831dca27a70882b28aa19f68b214a666cb0830ce4fa702f
|
4
|
+
data.tar.gz: 3c755dd00fad7455b402dd04ae7f649f554fce6127608e11f28c2e16f31c85d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50f8865e78282701c705fd9e5b1b0f9978f152d54b7594784806153d9ffc3654d57871f6a9c4dbe1917611853915e27ff16e9b893e2bc2d848a27f963596aa32
|
7
|
+
data.tar.gz: 41e18fea0a4047734d49c8a495dfb28c2c13b7a40ef4a4737f6ccf909e4894bca44048124793cb9924ed375000e12245be67eefe559967f943b1391f7f2024f3
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,50 +1,57 @@
|
|
1
1
|
name: CI
|
2
2
|
|
3
3
|
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- main
|
7
4
|
pull_request:
|
5
|
+
push:
|
8
6
|
branches:
|
9
7
|
- main
|
10
8
|
|
11
9
|
jobs:
|
12
|
-
|
13
|
-
name: Ruby
|
14
|
-
|
10
|
+
specs:
|
11
|
+
name: Ruby ${{ matrix.ruby-version }}
|
12
|
+
runs-on: ubuntu-latest
|
15
13
|
strategy:
|
16
14
|
matrix:
|
17
|
-
ruby:
|
18
|
-
- 2.
|
19
|
-
-
|
20
|
-
-
|
21
|
-
- 3.
|
22
|
-
|
23
|
-
runs-on: ubuntu-latest
|
24
|
-
|
15
|
+
ruby-version:
|
16
|
+
- '2.7'
|
17
|
+
- '3.0'
|
18
|
+
- '3.1'
|
19
|
+
- '3.2'
|
25
20
|
steps:
|
26
|
-
- uses: zendesk/checkout@
|
27
|
-
|
21
|
+
- uses: zendesk/checkout@v3
|
28
22
|
- uses: zendesk/setup-ruby@v1
|
29
23
|
with:
|
30
|
-
ruby-version: ${{ matrix.ruby }}
|
31
|
-
|
32
|
-
-
|
33
|
-
|
34
|
-
path: vendor/bundle
|
35
|
-
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
|
36
|
-
restore-keys: |
|
37
|
-
${{ runner.os }}-gems-
|
38
|
-
|
39
|
-
- name: Install Dependencies
|
40
|
-
run: |
|
41
|
-
bundle config deployment true
|
42
|
-
bundle config path vendor/bundle
|
43
|
-
bundle install --jobs 4
|
44
|
-
|
45
|
-
- name: Run Tests
|
46
|
-
run: bundle exec rake
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
bundler-cache: true
|
26
|
+
- name: Run Specs
|
27
|
+
run: bundle exec rake spec
|
47
28
|
env:
|
48
29
|
ZUORA_CLIENT_ID: something
|
49
30
|
ZUORA_CLIENT_SECRET: secret
|
50
31
|
ZUORA_DOMAIN: rest.apisandbox.zuora.com
|
32
|
+
|
33
|
+
specs_successful:
|
34
|
+
name: Specs passing?
|
35
|
+
needs: specs
|
36
|
+
if: always()
|
37
|
+
runs-on: ubuntu-latest
|
38
|
+
steps:
|
39
|
+
- run: |
|
40
|
+
if ${{ needs.specs.result == 'success' }}
|
41
|
+
then
|
42
|
+
echo "All specs pass"
|
43
|
+
else
|
44
|
+
echo "Some specs failed"
|
45
|
+
false
|
46
|
+
fi
|
47
|
+
|
48
|
+
lint:
|
49
|
+
runs-on: ubuntu-latest
|
50
|
+
steps:
|
51
|
+
- uses: zendesk/checkout@v3
|
52
|
+
- name: Set up Ruby
|
53
|
+
uses: zendesk/setup-ruby@v1
|
54
|
+
with:
|
55
|
+
ruby-version: "3.0"
|
56
|
+
bundler-cache: true
|
57
|
+
- run: bundle exec rake rubocop
|
@@ -0,0 +1,12 @@
|
|
1
|
+
name: Ruby Gem Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags: v*
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
call-workflow:
|
9
|
+
uses: zendesk/gw/.github/workflows/ruby-gem-publication.yml@main
|
10
|
+
secrets:
|
11
|
+
RUBY_GEMS_API_KEY: ${{ secrets.RUBY_GEMS_API_KEY }}
|
12
|
+
RUBY_GEMS_TOTP_DEVICE: ${{ secrets.RUBY_GEMS_TOTP_DEVICE }}
|
data/.reek.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.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
|
15
|
-
gem "rspec", "~> 3
|
16
|
-
gem "rubocop", "~> 1
|
17
|
-
gem "rubocop-performance", "~> 1
|
18
|
-
gem "shoulda-matchers", "~> 4
|
19
|
-
gem "simplecov", "~> 0.
|
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.
|
4
|
+
iron_bank (5.4.0)
|
5
5
|
faraday (~> 1)
|
6
6
|
faraday_middleware (~> 1)
|
7
7
|
nokogiri (~> 1)
|
@@ -9,115 +9,117 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (
|
12
|
+
activesupport (7.0.4.3)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
|
-
|
18
|
-
ast (2.4.1)
|
17
|
+
ast (2.4.2)
|
19
18
|
bump (0.10.0)
|
20
19
|
byebug (11.1.3)
|
21
20
|
coderay (1.1.3)
|
22
|
-
concurrent-ruby (1.
|
23
|
-
diff-lcs (1.
|
24
|
-
docile (1.
|
25
|
-
dotenv (2.
|
26
|
-
factory_bot (6.1
|
21
|
+
concurrent-ruby (1.2.2)
|
22
|
+
diff-lcs (1.5.0)
|
23
|
+
docile (1.4.0)
|
24
|
+
dotenv (2.8.1)
|
25
|
+
factory_bot (6.2.1)
|
27
26
|
activesupport (>= 5.0.0)
|
28
|
-
faraday (1.
|
27
|
+
faraday (1.10.3)
|
29
28
|
faraday-em_http (~> 1.0)
|
30
29
|
faraday-em_synchrony (~> 1.0)
|
31
30
|
faraday-excon (~> 1.1)
|
32
|
-
faraday-httpclient (~> 1.0
|
31
|
+
faraday-httpclient (~> 1.0)
|
32
|
+
faraday-multipart (~> 1.0)
|
33
33
|
faraday-net_http (~> 1.0)
|
34
|
-
faraday-net_http_persistent (~> 1.
|
34
|
+
faraday-net_http_persistent (~> 1.0)
|
35
35
|
faraday-patron (~> 1.0)
|
36
36
|
faraday-rack (~> 1.0)
|
37
|
-
|
37
|
+
faraday-retry (~> 1.0)
|
38
38
|
ruby2_keywords (>= 0.0.4)
|
39
39
|
faraday-em_http (1.0.0)
|
40
40
|
faraday-em_synchrony (1.0.0)
|
41
41
|
faraday-excon (1.1.0)
|
42
42
|
faraday-httpclient (1.0.1)
|
43
|
+
faraday-multipart (1.0.4)
|
44
|
+
multipart-post (~> 2)
|
43
45
|
faraday-net_http (1.0.1)
|
44
46
|
faraday-net_http_persistent (1.2.0)
|
45
47
|
faraday-patron (1.0.0)
|
46
48
|
faraday-rack (1.0.0)
|
47
|
-
|
49
|
+
faraday-retry (1.0.3)
|
50
|
+
faraday_middleware (1.2.0)
|
48
51
|
faraday (~> 1.0)
|
49
|
-
i18n (1.
|
52
|
+
i18n (1.13.0)
|
50
53
|
concurrent-ruby (~> 1.0)
|
54
|
+
json (2.6.3)
|
51
55
|
kwalify (0.7.2)
|
52
56
|
method_source (1.0.0)
|
53
|
-
mini_portile2 (2.
|
54
|
-
minitest (5.
|
55
|
-
multipart-post (2.
|
56
|
-
nokogiri (1.
|
57
|
-
mini_portile2 (~> 2.
|
57
|
+
mini_portile2 (2.8.2)
|
58
|
+
minitest (5.18.0)
|
59
|
+
multipart-post (2.3.0)
|
60
|
+
nokogiri (1.14.3)
|
61
|
+
mini_portile2 (~> 2.8.0)
|
58
62
|
racc (~> 1.4)
|
59
|
-
parallel (1.
|
60
|
-
parser (3.
|
63
|
+
parallel (1.23.0)
|
64
|
+
parser (3.2.2.1)
|
61
65
|
ast (~> 2.4.1)
|
62
|
-
pry (0.
|
66
|
+
pry (0.14.2)
|
63
67
|
coderay (~> 1.1)
|
64
68
|
method_source (~> 1.0)
|
65
|
-
pry-byebug (3.
|
69
|
+
pry-byebug (3.10.1)
|
66
70
|
byebug (~> 11.0)
|
67
|
-
pry (
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
reek (6.0.3)
|
71
|
+
pry (>= 0.13, < 0.15)
|
72
|
+
racc (1.6.2)
|
73
|
+
rainbow (3.1.1)
|
74
|
+
rake (13.0.6)
|
75
|
+
reek (6.1.4)
|
73
76
|
kwalify (~> 0.7.0)
|
74
|
-
parser (~> 3.
|
75
|
-
psych (~> 3.1)
|
77
|
+
parser (~> 3.2.0)
|
76
78
|
rainbow (>= 2.0, < 4.0)
|
77
|
-
regexp_parser (2.0
|
78
|
-
rexml (3.2.
|
79
|
-
rspec (3.
|
80
|
-
rspec-core (~> 3.
|
81
|
-
rspec-expectations (~> 3.
|
82
|
-
rspec-mocks (~> 3.
|
83
|
-
rspec-core (3.
|
84
|
-
rspec-support (~> 3.
|
85
|
-
rspec-expectations (3.
|
79
|
+
regexp_parser (2.8.0)
|
80
|
+
rexml (3.2.5)
|
81
|
+
rspec (3.12.0)
|
82
|
+
rspec-core (~> 3.12.0)
|
83
|
+
rspec-expectations (~> 3.12.0)
|
84
|
+
rspec-mocks (~> 3.12.0)
|
85
|
+
rspec-core (3.12.2)
|
86
|
+
rspec-support (~> 3.12.0)
|
87
|
+
rspec-expectations (3.12.3)
|
86
88
|
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
-
rspec-support (~> 3.
|
88
|
-
rspec-mocks (3.
|
89
|
+
rspec-support (~> 3.12.0)
|
90
|
+
rspec-mocks (3.12.5)
|
89
91
|
diff-lcs (>= 1.2.0, < 2.0)
|
90
|
-
rspec-support (~> 3.
|
91
|
-
rspec-support (3.
|
92
|
-
rubocop (1.
|
92
|
+
rspec-support (~> 3.12.0)
|
93
|
+
rspec-support (3.12.0)
|
94
|
+
rubocop (1.50.2)
|
95
|
+
json (~> 2.3)
|
93
96
|
parallel (~> 1.10)
|
94
|
-
parser (>= 3.
|
97
|
+
parser (>= 3.2.0.0)
|
95
98
|
rainbow (>= 2.2.2, < 4.0)
|
96
99
|
regexp_parser (>= 1.8, < 3.0)
|
97
|
-
rexml
|
98
|
-
rubocop-ast (>= 1.
|
100
|
+
rexml (>= 3.2.5, < 4.0)
|
101
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
99
102
|
ruby-progressbar (~> 1.7)
|
100
|
-
unicode-display_width (>=
|
101
|
-
rubocop-ast (1.
|
102
|
-
parser (>= 2.
|
103
|
-
rubocop-performance (1.
|
104
|
-
rubocop (>=
|
103
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
104
|
+
rubocop-ast (1.28.1)
|
105
|
+
parser (>= 3.2.1.0)
|
106
|
+
rubocop-performance (1.17.1)
|
107
|
+
rubocop (>= 1.7.0, < 2.0)
|
105
108
|
rubocop-ast (>= 0.4.0)
|
106
|
-
ruby-progressbar (1.
|
109
|
+
ruby-progressbar (1.13.0)
|
107
110
|
ruby2_keywords (0.0.5)
|
108
|
-
shoulda-matchers (4.5.
|
111
|
+
shoulda-matchers (4.5.1)
|
109
112
|
activesupport (>= 4.2.0)
|
110
|
-
simplecov (0.
|
113
|
+
simplecov (0.22.0)
|
111
114
|
docile (~> 1.1)
|
112
115
|
simplecov-html (~> 0.11)
|
113
116
|
simplecov_json_formatter (~> 0.1)
|
114
117
|
simplecov-html (0.12.3)
|
115
|
-
simplecov_json_formatter (0.1.
|
116
|
-
timecop (0.9.
|
117
|
-
tzinfo (2.0.
|
118
|
+
simplecov_json_formatter (0.1.4)
|
119
|
+
timecop (0.9.6)
|
120
|
+
tzinfo (2.0.6)
|
118
121
|
concurrent-ruby (~> 1.0)
|
119
|
-
unicode-display_width (2.
|
120
|
-
zeitwerk (2.4.2)
|
122
|
+
unicode-display_width (2.4.2)
|
121
123
|
|
122
124
|
PLATFORMS
|
123
125
|
ruby
|
@@ -130,13 +132,13 @@ DEPENDENCIES
|
|
130
132
|
iron_bank!
|
131
133
|
pry-byebug (~> 3.4)
|
132
134
|
rake (~> 13.0)
|
133
|
-
reek (~> 6
|
134
|
-
rspec (~> 3
|
135
|
-
rubocop (~> 1
|
136
|
-
rubocop-performance (~> 1
|
137
|
-
shoulda-matchers (~> 4
|
138
|
-
simplecov (~> 0.
|
135
|
+
reek (~> 6)
|
136
|
+
rspec (~> 3)
|
137
|
+
rubocop (~> 1)
|
138
|
+
rubocop-performance (~> 1)
|
139
|
+
shoulda-matchers (~> 4)
|
140
|
+
simplecov (~> 0.21)
|
139
141
|
timecop (~> 0.9)
|
140
142
|
|
141
143
|
BUNDLED WITH
|
142
|
-
2.
|
144
|
+
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.
|
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.
|
36
|
+
File.write(destination, Psych.dump(fields))
|
37
37
|
end
|
38
38
|
|
39
39
|
# Helper function to set up an `IronBank::Client` instance
|
@@ -42,10 +42,10 @@ def setup_iron_bank
|
|
42
42
|
require "iron_bank"
|
43
43
|
|
44
44
|
IronBank.configure do |config|
|
45
|
-
config.client_id = ENV
|
46
|
-
config.client_secret = ENV
|
45
|
+
config.client_id = ENV.fetch("ZUORA_CLIENT_ID", nil)
|
46
|
+
config.client_secret = ENV.fetch("ZUORA_CLIENT_SECRET", nil)
|
47
47
|
config.auth_type = ENV.fetch("ZUORA_AUTH_TYPE", "token")
|
48
|
-
config.domain = ENV
|
49
|
-
config.excluded_fields_file = ENV
|
48
|
+
config.domain = ENV.fetch("ZUORA_DOMAIN", nil)
|
49
|
+
config.excluded_fields_file = ENV.fetch("ZUORA_EXCLUDED_FIELDS_FILE", nil)
|
50
50
|
end
|
51
51
|
end
|
data/bin/console
CHANGED
@@ -7,12 +7,12 @@ require "iron_bank"
|
|
7
7
|
require "pry-byebug"
|
8
8
|
|
9
9
|
IronBank.configure do |config|
|
10
|
-
config.client_id = ENV
|
11
|
-
config.client_secret = ENV
|
10
|
+
config.client_id = ENV.fetch("ZUORA_CLIENT_ID", nil)
|
11
|
+
config.client_secret = ENV.fetch("ZUORA_CLIENT_SECRET", nil)
|
12
12
|
config.auth_type = ENV.fetch("ZUORA_AUTH_TYPE", "token")
|
13
|
-
config.domain = ENV
|
14
|
-
config.excluded_fields_file = ENV
|
15
|
-
config.users_file = ENV
|
13
|
+
config.domain = ENV.fetch("ZUORA_DOMAIN", nil)
|
14
|
+
config.excluded_fields_file = ENV.fetch("ZUORA_EXCLUDED_FIELDS_FILE", nil)
|
15
|
+
config.users_file = ENV.fetch("ZUORA_USERS_FILE", nil)
|
16
16
|
end
|
17
17
|
|
18
18
|
Pry.start
|
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.
|
22
|
+
spec.required_ruby_version = ">= 2.7"
|
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
|
data/lib/iron_bank/action.rb
CHANGED
@@ -39,13 +39,11 @@ module IronBank
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def response_object
|
42
|
-
@response_object ||=
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
data/lib/iron_bank/client.rb
CHANGED
@@ -99,7 +99,11 @@ module IronBank
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def headers
|
102
|
-
|
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
|
data/lib/iron_bank/collection.rb
CHANGED
@@ -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
|
42
|
-
@export_directory
|
43
|
-
@logger
|
44
|
-
@auth_type
|
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 ||=
|
98
|
-
|
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
|
data/lib/iron_bank/error.rb
CHANGED
@@ -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 =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
@@ -18,7 +18,7 @@ module IronBank
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.export
|
21
|
-
FileUtils.mkdir_p(directory)
|
21
|
+
FileUtils.mkdir_p(directory)
|
22
22
|
RESOURCE_QUERY_FIELDS.each_key { |resource| new(resource).save_file }
|
23
23
|
end
|
24
24
|
|
@@ -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
|
@@ -64,7 +64,7 @@ module IronBank
|
|
64
64
|
|
65
65
|
def ensure_range_single_condition
|
66
66
|
return if conditions.count <= 1
|
67
|
-
return unless conditions.values.any?
|
67
|
+
return unless conditions.values.any?(Array)
|
68
68
|
|
69
69
|
raise "Filter ranges must be used in isolation."
|
70
70
|
end
|
data/lib/iron_bank/schema.rb
CHANGED
@@ -12,7 +12,7 @@ module IronBank
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.export
|
15
|
-
FileUtils.mkdir_p(directory)
|
15
|
+
FileUtils.mkdir_p(directory)
|
16
16
|
new(IronBank.client).export
|
17
17
|
reset
|
18
18
|
import
|
@@ -39,11 +39,9 @@ module IronBank
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.excluded_fields
|
42
|
-
@excluded_fields ||=
|
43
|
-
|
44
|
-
|
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
|
|
data/lib/iron_bank/user.rb
CHANGED
@@ -16,14 +16,12 @@ module IronBank
|
|
16
16
|
def store
|
17
17
|
return {} unless users_file
|
18
18
|
|
19
|
-
@store ||=
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
data/lib/iron_bank/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_bank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickael Pham
|
8
8
|
- Cheng Cui
|
9
9
|
- Ryan Ringler
|
10
10
|
- Mustafa Turan
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-05-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '1'
|
58
|
-
description:
|
58
|
+
description:
|
59
59
|
email:
|
60
60
|
- mickael@zendesk.com
|
61
61
|
- ccui@zendesk.com
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- ".github/CODEOWNERS"
|
70
70
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
71
71
|
- ".github/workflows/ci.yml"
|
72
|
+
- ".github/workflows/ruby-gem-publication.yml"
|
72
73
|
- ".gitignore"
|
73
74
|
- ".reek.yml"
|
74
75
|
- ".rspec"
|
@@ -154,8 +155,9 @@ files:
|
|
154
155
|
homepage: https://github.com/zendesk/iron_bank
|
155
156
|
licenses:
|
156
157
|
- Apache-2.0
|
157
|
-
metadata:
|
158
|
-
|
158
|
+
metadata:
|
159
|
+
rubygems_mfa_required: 'true'
|
160
|
+
post_install_message:
|
159
161
|
rdoc_options: []
|
160
162
|
require_paths:
|
161
163
|
- lib
|
@@ -163,16 +165,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
165
|
requirements:
|
164
166
|
- - ">="
|
165
167
|
- !ruby/object:Gem::Version
|
166
|
-
version: '2.
|
168
|
+
version: '2.7'
|
167
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
170
|
requirements:
|
169
171
|
- - ">="
|
170
172
|
- !ruby/object:Gem::Version
|
171
173
|
version: '0'
|
172
174
|
requirements: []
|
173
|
-
|
174
|
-
|
175
|
-
signing_key:
|
175
|
+
rubygems_version: 3.0.3.1
|
176
|
+
signing_key:
|
176
177
|
specification_version: 4
|
177
178
|
summary: An opinionated Ruby interface to the Zuora API.
|
178
179
|
test_files: []
|