iron_bank 4.4.1 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/CODEOWNERS +1 -1
- data/.github/workflows/ci.yml +49 -0
- data/.rubocop.yml +5 -9
- data/.ruby-version +1 -1
- data/Gemfile.lock +64 -76
- data/README.md +8 -10
- data/iron_bank.gemspec +5 -5
- data/lib/iron_bank.rb +1 -1
- data/lib/iron_bank/actions/query.rb +2 -0
- data/lib/iron_bank/associations.rb +3 -5
- data/lib/iron_bank/authentication.rb +1 -1
- data/lib/iron_bank/authentications/cookie.rb +2 -2
- data/lib/iron_bank/configuration.rb +1 -1
- data/lib/iron_bank/describe/excluded_fields.rb +2 -4
- data/lib/iron_bank/endpoint.rb +1 -1
- data/lib/iron_bank/local.rb +15 -4
- data/lib/iron_bank/local_records.rb +1 -1
- data/lib/iron_bank/logger.rb +1 -1
- data/lib/iron_bank/schema.rb +4 -6
- data/lib/iron_bank/version.rb +1 -1
- metadata +17 -18
- data/.travis.yml +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 717f79f19195a17039f32fcc0904ad38536b5fff464d70e82e1904ccae2dfae1
|
4
|
+
data.tar.gz: 5ab23d9bfc1ebfcb86a51a11f91e6c03cb5ed59cfa43970deb4c10cf03c4f5dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8667f6dc6eec4fa269e7fce909615353e4afc58d472c587790abfca71d02199fcd7aa4909e75b1d7267521492a16ac5ce3dc1884b7735bc1b5edc2263da6ce3
|
7
|
+
data.tar.gz: 34dd5db61b474c445de6027c7548dfe8b735e56a595c98c1d14aea6b0b3966557eb592355972cb2a6e45379b935dba5832c3e2d4d125d248c4bfb5820e764b23
|
data/.github/CODEOWNERS
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* @zendesk/
|
1
|
+
* @zendesk/billing
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
name: Ruby
|
14
|
+
|
15
|
+
strategy:
|
16
|
+
matrix:
|
17
|
+
ruby:
|
18
|
+
- 2.5
|
19
|
+
- 2.6
|
20
|
+
- 2.7
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: zendesk/checkout@v2
|
26
|
+
|
27
|
+
- uses: zendesk/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
30
|
+
|
31
|
+
- uses: zendesk/cache@v2
|
32
|
+
with:
|
33
|
+
path: vendor/bundle
|
34
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
|
35
|
+
restore-keys: |
|
36
|
+
${{ runner.os }}-gems-
|
37
|
+
|
38
|
+
- name: Install Dependencies
|
39
|
+
run: |
|
40
|
+
bundle config deployment true
|
41
|
+
bundle config path vendor/bundle
|
42
|
+
bundle install --jobs 4
|
43
|
+
|
44
|
+
- name: Run Tests
|
45
|
+
run: bundle exec rake
|
46
|
+
env:
|
47
|
+
ZUORA_CLIENT_ID: something
|
48
|
+
ZUORA_CLIENT_SECRET: secret
|
49
|
+
ZUORA_DOMAIN: rest.apisandbox.zuora.com
|
data/.rubocop.yml
CHANGED
@@ -3,12 +3,12 @@ require: rubocop-performance
|
|
3
3
|
AllCops:
|
4
4
|
DisplayCopNames: true
|
5
5
|
DisplayStyleGuide: true
|
6
|
-
|
6
|
+
NewCops: enable
|
7
7
|
|
8
8
|
Layout/DotPosition:
|
9
9
|
EnforcedStyle: trailing
|
10
10
|
|
11
|
-
Layout/
|
11
|
+
Layout/HashAlignment:
|
12
12
|
EnforcedHashRocketStyle: table
|
13
13
|
EnforcedColonStyle: table
|
14
14
|
|
@@ -39,10 +39,6 @@ Metrics/MethodLength:
|
|
39
39
|
- lib/iron_bank/error.rb
|
40
40
|
- lib/iron_bank/client.rb
|
41
41
|
|
42
|
-
Metrics/LineLength:
|
43
|
-
Exclude:
|
44
|
-
- lib/iron_bank.rb
|
45
|
-
|
46
42
|
Style/ClassAndModuleChildren:
|
47
43
|
EnforcedStyle: nested
|
48
44
|
|
@@ -50,6 +46,9 @@ Style/MixinUsage:
|
|
50
46
|
Exclude:
|
51
47
|
- lib/iron_bank/resource.rb
|
52
48
|
|
49
|
+
Style/StringLiterals:
|
50
|
+
EnforcedStyle: double_quotes
|
51
|
+
|
53
52
|
Style/OptionalArguments:
|
54
53
|
Exclude:
|
55
54
|
- lib/iron_bank/local.rb
|
@@ -63,6 +62,3 @@ Style/RegexpLiteral:
|
|
63
62
|
Style/RescueStandardError:
|
64
63
|
Exclude:
|
65
64
|
- lib/iron_bank/csv.rb
|
66
|
-
|
67
|
-
Style/StringLiterals:
|
68
|
-
EnforcedStyle: double_quotes
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.8
|
data/Gemfile.lock
CHANGED
@@ -1,114 +1,102 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
iron_bank (
|
5
|
-
faraday (~>
|
6
|
-
faraday_middleware (~>
|
4
|
+
iron_bank (5.1.1)
|
5
|
+
faraday (~> 1)
|
6
|
+
faraday_middleware (~> 1)
|
7
7
|
nokogiri (~> 1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (
|
12
|
+
activesupport (6.0.3.3)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
codeclimate-engine-rb (0.4.1)
|
25
|
-
virtus (~> 1.0)
|
26
|
-
coderay (1.1.2)
|
27
|
-
coercible (1.0.0)
|
28
|
-
descendants_tracker (~> 0.0.1)
|
29
|
-
concurrent-ruby (1.1.5)
|
30
|
-
descendants_tracker (0.0.4)
|
31
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
32
|
-
diff-lcs (1.3)
|
17
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
+
ast (2.4.1)
|
19
|
+
bump (0.9.0)
|
20
|
+
byebug (11.1.3)
|
21
|
+
coderay (1.1.3)
|
22
|
+
concurrent-ruby (1.1.7)
|
23
|
+
diff-lcs (1.4.4)
|
33
24
|
docile (1.3.2)
|
34
|
-
dotenv (2.7.
|
35
|
-
|
36
|
-
factory_bot (5.0.2)
|
25
|
+
dotenv (2.7.6)
|
26
|
+
factory_bot (5.2.0)
|
37
27
|
activesupport (>= 4.2.0)
|
38
|
-
faraday (0.
|
28
|
+
faraday (1.0.1)
|
39
29
|
multipart-post (>= 1.2, < 3)
|
40
|
-
faraday_middleware (0.
|
41
|
-
faraday (
|
42
|
-
i18n (1.
|
30
|
+
faraday_middleware (1.0.0)
|
31
|
+
faraday (~> 1.0)
|
32
|
+
i18n (1.8.5)
|
43
33
|
concurrent-ruby (~> 1.0)
|
44
|
-
ice_nine (0.11.2)
|
45
|
-
jaro_winkler (1.5.3)
|
46
|
-
json (2.2.0)
|
47
34
|
kwalify (0.7.2)
|
48
|
-
method_source (0.
|
35
|
+
method_source (1.0.0)
|
49
36
|
mini_portile2 (2.4.0)
|
50
|
-
minitest (5.
|
37
|
+
minitest (5.14.2)
|
51
38
|
multipart-post (2.1.1)
|
52
|
-
nokogiri (1.10.
|
39
|
+
nokogiri (1.10.10)
|
53
40
|
mini_portile2 (~> 2.4.0)
|
54
|
-
parallel (1.
|
55
|
-
parser (2.
|
56
|
-
ast (~> 2.4.
|
57
|
-
pry (0.
|
58
|
-
coderay (~> 1.1
|
59
|
-
method_source (~>
|
60
|
-
pry-byebug (3.
|
41
|
+
parallel (1.19.2)
|
42
|
+
parser (2.7.1.5)
|
43
|
+
ast (~> 2.4.1)
|
44
|
+
pry (0.13.1)
|
45
|
+
coderay (~> 1.1)
|
46
|
+
method_source (~> 1.0)
|
47
|
+
pry-byebug (3.9.0)
|
61
48
|
byebug (~> 11.0)
|
62
|
-
pry (~> 0.
|
49
|
+
pry (~> 0.13.0)
|
63
50
|
psych (3.1.0)
|
64
51
|
rainbow (3.0.0)
|
65
|
-
rake (
|
66
|
-
reek (
|
67
|
-
codeclimate-engine-rb (~> 0.4.0)
|
52
|
+
rake (13.0.1)
|
53
|
+
reek (6.0.1)
|
68
54
|
kwalify (~> 0.7.0)
|
69
|
-
parser (>= 2.5.0.0, < 2.
|
55
|
+
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
|
70
56
|
psych (~> 3.1.0)
|
71
57
|
rainbow (>= 2.0, < 4.0)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
rspec-
|
76
|
-
|
77
|
-
rspec-
|
78
|
-
rspec-
|
58
|
+
regexp_parser (1.8.1)
|
59
|
+
rexml (3.2.4)
|
60
|
+
rspec (3.9.0)
|
61
|
+
rspec-core (~> 3.9.0)
|
62
|
+
rspec-expectations (~> 3.9.0)
|
63
|
+
rspec-mocks (~> 3.9.0)
|
64
|
+
rspec-core (3.9.2)
|
65
|
+
rspec-support (~> 3.9.3)
|
66
|
+
rspec-expectations (3.9.2)
|
79
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
-
rspec-support (~> 3.
|
81
|
-
rspec-mocks (3.
|
68
|
+
rspec-support (~> 3.9.0)
|
69
|
+
rspec-mocks (3.9.1)
|
82
70
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-support (3.
|
85
|
-
rubocop (0.
|
86
|
-
jaro_winkler (~> 1.5.1)
|
71
|
+
rspec-support (~> 3.9.0)
|
72
|
+
rspec-support (3.9.3)
|
73
|
+
rubocop (0.92.0)
|
87
74
|
parallel (~> 1.10)
|
88
|
-
parser (>= 2.
|
75
|
+
parser (>= 2.7.1.5)
|
89
76
|
rainbow (>= 2.2.2, < 4.0)
|
77
|
+
regexp_parser (>= 1.7)
|
78
|
+
rexml
|
79
|
+
rubocop-ast (>= 0.5.0)
|
90
80
|
ruby-progressbar (~> 1.7)
|
91
|
-
unicode-display_width (>= 1.4.0, <
|
92
|
-
rubocop-
|
93
|
-
|
81
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
82
|
+
rubocop-ast (0.7.1)
|
83
|
+
parser (>= 2.7.1.5)
|
84
|
+
rubocop-performance (1.8.1)
|
85
|
+
rubocop (>= 0.87.0)
|
86
|
+
rubocop-ast (>= 0.4.0)
|
94
87
|
ruby-progressbar (1.10.1)
|
95
|
-
shoulda-matchers (4.1
|
88
|
+
shoulda-matchers (4.4.1)
|
96
89
|
activesupport (>= 4.2.0)
|
97
|
-
simplecov (0.
|
90
|
+
simplecov (0.19.0)
|
98
91
|
docile (~> 1.1)
|
99
|
-
|
100
|
-
|
101
|
-
simplecov-html (0.10.2)
|
92
|
+
simplecov-html (~> 0.11)
|
93
|
+
simplecov-html (0.12.3)
|
102
94
|
thread_safe (0.3.6)
|
103
95
|
timecop (0.9.1)
|
104
|
-
tzinfo (1.2.
|
96
|
+
tzinfo (1.2.7)
|
105
97
|
thread_safe (~> 0.1)
|
106
|
-
unicode-display_width (1.
|
107
|
-
|
108
|
-
axiom-types (~> 0.1)
|
109
|
-
coercible (~> 1.0)
|
110
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
111
|
-
equalizer (~> 0.0, >= 0.0.9)
|
98
|
+
unicode-display_width (1.7.0)
|
99
|
+
zeitwerk (2.4.0)
|
112
100
|
|
113
101
|
PLATFORMS
|
114
102
|
ruby
|
@@ -120,8 +108,8 @@ DEPENDENCIES
|
|
120
108
|
factory_bot (~> 5.0)
|
121
109
|
iron_bank!
|
122
110
|
pry-byebug (~> 3.4)
|
123
|
-
rake (~>
|
124
|
-
reek (~>
|
111
|
+
rake (~> 13.0)
|
112
|
+
reek (~> 6.0)
|
125
113
|
rspec (~> 3.0)
|
126
114
|
rubocop (~> 0.67)
|
127
115
|
rubocop-performance (~> 1.0)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Iron Bank
|
2
2
|
|
3
|
-
|
3
|
+
![CI](https://github.com/zendesk/iron_bank/workflows/CI/badge.svg?branch=main)
|
4
4
|
|
5
5
|
An opinionated Ruby interface to the [Zuora REST API][zuora-dev].
|
6
6
|
|
@@ -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.5`.
|
17
17
|
|
18
18
|
Please use [GitHub Issues][issues] to report bugs.
|
19
19
|
|
@@ -23,8 +23,7 @@ You will need:
|
|
23
23
|
|
24
24
|
- a **Zuora tenant** (apisandbox, services, performances or production)
|
25
25
|
- an **administrator access** to this tenant (to gain API access)
|
26
|
-
- and an **OAuth client** for this user
|
27
|
-
([Zuora documentation][zuora-doc-oauth])
|
26
|
+
- and an **OAuth client** for this user ([Zuora documentation][zuora-doc-oauth])
|
28
27
|
|
29
28
|
IronBank is a pure Ruby client, but we do provide a generator (for the
|
30
29
|
configuration) when using it within [Rails][rails-website].
|
@@ -89,9 +88,9 @@ account.active_subscriptions
|
|
89
88
|
|
90
89
|
## Local records
|
91
90
|
|
92
|
-
If your product catalog does not change often, you may want to export
|
93
|
-
|
94
|
-
|
91
|
+
If your product catalog does not change often, you may want to export it locally
|
92
|
+
so that product catalog and related object queries look for **local records**
|
93
|
+
first, then **fallback** to the API if no records are found.
|
95
94
|
|
96
95
|
You can export your product catalog locally using the `LocalRecords` class:
|
97
96
|
|
@@ -155,10 +154,9 @@ CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
155
154
|
specific language governing permissions and limitations under the License.
|
156
155
|
|
157
156
|
[issues]: https://github.com/zendesk/iron_bank/issues
|
158
|
-
[travis-status]: https://travis-ci.com/zendesk/iron_bank.svg?token=Qzkq5papoR7sdedznjeb&branch=master
|
159
|
-
[travis-build]: https://travis-ci.com/zendesk/iron_bank
|
160
157
|
[zuora-describe]: https://www.zuora.com/developer/api-reference/#tag/Describe
|
161
158
|
[zuora-dev]: https://developer.zuora.com
|
162
|
-
[zuora-doc-oauth]:
|
159
|
+
[zuora-doc-oauth]:
|
160
|
+
https://knowledgecenter.zuora.com/CF_Users_and_Administrators/A_Administrator_Settings/Manage_Users#Create_an_OAuth_Client_for_a_User
|
163
161
|
[zuora-website]: https://www.zuora.com
|
164
162
|
[rails-website]: https://rubyonrails.org/
|
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.5"
|
23
23
|
|
24
24
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
25
|
f.match(%r{^(test|spec|features)/})
|
@@ -34,8 +34,8 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency "dotenv", "~> 2.2"
|
35
35
|
spec.add_development_dependency "factory_bot", "~> 5.0"
|
36
36
|
spec.add_development_dependency "pry-byebug", "~> 3.4"
|
37
|
-
spec.add_development_dependency "rake", "~>
|
38
|
-
spec.add_development_dependency "reek", "~>
|
37
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
38
|
+
spec.add_development_dependency "reek", "~> 6.0"
|
39
39
|
spec.add_development_dependency "rspec", "~> 3.0"
|
40
40
|
spec.add_development_dependency "rubocop", "~> 0.67"
|
41
41
|
spec.add_development_dependency "rubocop-performance", "~> 1.0"
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
44
44
|
spec.add_development_dependency "timecop", "~> 0.9"
|
45
45
|
|
46
|
-
spec.add_runtime_dependency "faraday", "~>
|
47
|
-
spec.add_runtime_dependency "faraday_middleware", "~>
|
46
|
+
spec.add_runtime_dependency "faraday", "~> 1"
|
47
|
+
spec.add_runtime_dependency "faraday_middleware", "~> 1"
|
48
48
|
spec.add_runtime_dependency "nokogiri", "~> 1"
|
49
49
|
end
|
data/lib/iron_bank.rb
CHANGED
@@ -12,7 +12,7 @@ module IronBank
|
|
12
12
|
:resource_name,
|
13
13
|
IronBank::Utils.camelize(name)
|
14
14
|
)
|
15
|
-
foreign_key = options.fetch(:foreign_key, name
|
15
|
+
foreign_key = options.fetch(:foreign_key, "#{name}_id")
|
16
16
|
|
17
17
|
define_method(name) do
|
18
18
|
return unless (foreign_key_value = public_send(foreign_key))
|
@@ -37,7 +37,7 @@ module IronBank
|
|
37
37
|
|
38
38
|
foreign_key = options.fetch(
|
39
39
|
:foreign_key,
|
40
|
-
IronBank::Utils.underscore(object_name)
|
40
|
+
"#{IronBank::Utils.underscore(object_name)}_id"
|
41
41
|
)
|
42
42
|
|
43
43
|
define_method(name) do
|
@@ -60,9 +60,7 @@ module IronBank
|
|
60
60
|
def with_memoization(name)
|
61
61
|
# NOTE: We use `instance_variables.include?` instead of `defined?`.
|
62
62
|
# Later it will always evaluate to `true` because it's an expression.
|
63
|
-
if instance_variables.include?(:"@#{name}")
|
64
|
-
return instance_variable_get(:"@#{name}")
|
65
|
-
end
|
63
|
+
return instance_variable_get(:"@#{name}") if instance_variables.include?(:"@#{name}")
|
66
64
|
|
67
65
|
memoizable = yield
|
68
66
|
instance_variable_set(:"@#{name}", memoizable)
|
@@ -43,7 +43,7 @@ module IronBank
|
|
43
43
|
alias refetch_cookie fetch_cookie
|
44
44
|
|
45
45
|
def fetch_zsession
|
46
|
-
/ZSession=([
|
46
|
+
/ZSession=([^;]+)/.match(cookie)[0]
|
47
47
|
end
|
48
48
|
|
49
49
|
def authenticate
|
@@ -51,7 +51,7 @@ module IronBank
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def connection
|
54
|
-
@connection ||= Faraday.new(faraday_config) do |conn|
|
54
|
+
@connection ||= Faraday.new(**faraday_config) do |conn|
|
55
55
|
IronBank.configuration.middlewares.each do |klass, options|
|
56
56
|
conn.use klass, options
|
57
57
|
end
|
@@ -63,7 +63,7 @@ module IronBank
|
|
63
63
|
@export_directory = value
|
64
64
|
return unless defined? IronBank::Product
|
65
65
|
|
66
|
-
IronBank::LocalRecords::RESOURCE_QUERY_FIELDS.
|
66
|
+
IronBank::LocalRecords::RESOURCE_QUERY_FIELDS.each_key do |resource|
|
67
67
|
IronBank::Resources.const_get(resource).reset_store
|
68
68
|
end
|
69
69
|
end
|
@@ -87,7 +87,7 @@ module IronBank
|
|
87
87
|
info "Successful query for #{object_name}"
|
88
88
|
|
89
89
|
true
|
90
|
-
rescue IronBank::InternalServerError => e
|
90
|
+
rescue IronBank::InternalServerError, IronBank::BadRequestError => e
|
91
91
|
@last_failed_fields = extract_fields_from_exception(e)
|
92
92
|
|
93
93
|
false
|
@@ -96,9 +96,7 @@ module IronBank
|
|
96
96
|
def extract_fields_from_exception(exception)
|
97
97
|
message = exception.message
|
98
98
|
|
99
|
-
unless FAULT_FIELD_MESSAGES.match(message)
|
100
|
-
raise "Could not parse error message: #{message}"
|
101
|
-
end
|
99
|
+
raise "Could not parse error message: #{message}" unless FAULT_FIELD_MESSAGES.match(message)
|
102
100
|
|
103
101
|
failed_fields = Regexp.last_match.
|
104
102
|
captures.
|
data/lib/iron_bank/endpoint.rb
CHANGED
@@ -7,7 +7,7 @@ module IronBank
|
|
7
7
|
private_class_method :new
|
8
8
|
|
9
9
|
PRODUCTION = /\Arest\.zuora\.com\z/i.freeze
|
10
|
-
SERVICES = /\
|
10
|
+
SERVICES = /\A(rest)?services(\d+)\.zuora\.com(:\d+)?\z/i.freeze
|
11
11
|
APISANDBOX = /\Arest.apisandbox.zuora\.com\z/i.freeze
|
12
12
|
|
13
13
|
def self.base_url(domain = "")
|
data/lib/iron_bank/local.rb
CHANGED
@@ -8,11 +8,11 @@ module IronBank
|
|
8
8
|
store[id] || super
|
9
9
|
end
|
10
10
|
|
11
|
-
def find_each
|
11
|
+
def find_each(&block)
|
12
12
|
return enum_for(:find_each) unless block_given?
|
13
13
|
|
14
14
|
values = store.values
|
15
|
-
values.any? ? values.each
|
15
|
+
values.any? ? values.each(&block) : super
|
16
16
|
end
|
17
17
|
|
18
18
|
def all
|
@@ -25,7 +25,9 @@ module IronBank
|
|
25
25
|
|
26
26
|
def where(conditions, limit: IronBank::Actions::Query::DEFAULT_ZUORA_LIMIT)
|
27
27
|
records = store.values.select do |record|
|
28
|
-
conditions.all?
|
28
|
+
conditions.all? do |field, match_value|
|
29
|
+
value_matches?(record.public_send(field), match_value)
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
records.any? ? records : super
|
@@ -55,7 +57,7 @@ module IronBank
|
|
55
57
|
end
|
56
58
|
|
57
59
|
def load_records
|
58
|
-
CSV.foreach(file_path, csv_options).with_object({}) do |row, store|
|
60
|
+
CSV.foreach(file_path, **csv_options).with_object({}) do |row, store|
|
59
61
|
store[row[:id]] = new(row.to_h.compact)
|
60
62
|
end
|
61
63
|
end
|
@@ -81,5 +83,14 @@ module IronBank
|
|
81
83
|
IronBank.configuration.export_directory
|
82
84
|
)
|
83
85
|
end
|
86
|
+
|
87
|
+
# :reek:UtilityFunction
|
88
|
+
def value_matches?(record_value, match_value)
|
89
|
+
if match_value.is_a? Array
|
90
|
+
match_value.include? record_value
|
91
|
+
else
|
92
|
+
record_value == match_value
|
93
|
+
end
|
94
|
+
end
|
84
95
|
end
|
85
96
|
end
|
@@ -19,7 +19,7 @@ module IronBank
|
|
19
19
|
|
20
20
|
def self.export
|
21
21
|
FileUtils.mkdir_p(directory) unless Dir.exist?(directory)
|
22
|
-
RESOURCE_QUERY_FIELDS.
|
22
|
+
RESOURCE_QUERY_FIELDS.each_key { |resource| new(resource).save_file }
|
23
23
|
end
|
24
24
|
|
25
25
|
def save_file
|
data/lib/iron_bank/logger.rb
CHANGED
@@ -14,7 +14,7 @@ module IronBank
|
|
14
14
|
|
15
15
|
def_delegators :@logger, :debug, :info, :warn, :error, :fatal
|
16
16
|
|
17
|
-
def initialize(logger: ::Logger.new(
|
17
|
+
def initialize(logger: ::Logger.new($stdout), level: LEVEL)
|
18
18
|
@logger = logger
|
19
19
|
@logger.progname = PROGNAME
|
20
20
|
@logger.level = level
|
data/lib/iron_bank/schema.rb
CHANGED
@@ -49,12 +49,10 @@ module IronBank
|
|
49
49
|
|
50
50
|
def export
|
51
51
|
tenant.objects.compact.each do |object|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
next
|
57
|
-
end
|
52
|
+
object.export
|
53
|
+
rescue IronBank::Describe::Object::InvalidXML
|
54
|
+
# TODO: log the object error
|
55
|
+
next
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
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:
|
4
|
+
version: 5.1.1
|
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: 2020-
|
14
|
+
date: 2020-09-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bump
|
@@ -89,28 +89,28 @@ dependencies:
|
|
89
89
|
requirements:
|
90
90
|
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
92
|
+
version: '13.0'
|
93
93
|
type: :development
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
99
|
+
version: '13.0'
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: reek
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
104
|
- - "~>"
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
106
|
+
version: '6.0'
|
107
107
|
type: :development
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: '
|
113
|
+
version: '6.0'
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: rspec
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,28 +201,28 @@ dependencies:
|
|
201
201
|
requirements:
|
202
202
|
- - "~>"
|
203
203
|
- !ruby/object:Gem::Version
|
204
|
-
version: '
|
204
|
+
version: '1'
|
205
205
|
type: :runtime
|
206
206
|
prerelease: false
|
207
207
|
version_requirements: !ruby/object:Gem::Requirement
|
208
208
|
requirements:
|
209
209
|
- - "~>"
|
210
210
|
- !ruby/object:Gem::Version
|
211
|
-
version: '
|
211
|
+
version: '1'
|
212
212
|
- !ruby/object:Gem::Dependency
|
213
213
|
name: faraday_middleware
|
214
214
|
requirement: !ruby/object:Gem::Requirement
|
215
215
|
requirements:
|
216
216
|
- - "~>"
|
217
217
|
- !ruby/object:Gem::Version
|
218
|
-
version: '
|
218
|
+
version: '1'
|
219
219
|
type: :runtime
|
220
220
|
prerelease: false
|
221
221
|
version_requirements: !ruby/object:Gem::Requirement
|
222
222
|
requirements:
|
223
223
|
- - "~>"
|
224
224
|
- !ruby/object:Gem::Version
|
225
|
-
version: '
|
225
|
+
version: '1'
|
226
226
|
- !ruby/object:Gem::Dependency
|
227
227
|
name: nokogiri
|
228
228
|
requirement: !ruby/object:Gem::Requirement
|
@@ -237,7 +237,7 @@ dependencies:
|
|
237
237
|
- - "~>"
|
238
238
|
- !ruby/object:Gem::Version
|
239
239
|
version: '1'
|
240
|
-
description:
|
240
|
+
description:
|
241
241
|
email:
|
242
242
|
- mickael@zendesk.com
|
243
243
|
- ccui@zendesk.com
|
@@ -250,12 +250,12 @@ files:
|
|
250
250
|
- ".env.example"
|
251
251
|
- ".github/CODEOWNERS"
|
252
252
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
253
|
+
- ".github/workflows/ci.yml"
|
253
254
|
- ".gitignore"
|
254
255
|
- ".reek.yml"
|
255
256
|
- ".rspec"
|
256
257
|
- ".rubocop.yml"
|
257
258
|
- ".ruby-version"
|
258
|
-
- ".travis.yml"
|
259
259
|
- Gemfile
|
260
260
|
- Gemfile.lock
|
261
261
|
- LICENSE
|
@@ -337,7 +337,7 @@ homepage: https://github.com/zendesk/iron_bank
|
|
337
337
|
licenses:
|
338
338
|
- Apache-2.0
|
339
339
|
metadata: {}
|
340
|
-
post_install_message:
|
340
|
+
post_install_message:
|
341
341
|
rdoc_options: []
|
342
342
|
require_paths:
|
343
343
|
- lib
|
@@ -345,16 +345,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
345
345
|
requirements:
|
346
346
|
- - ">="
|
347
347
|
- !ruby/object:Gem::Version
|
348
|
-
version: '2.
|
348
|
+
version: '2.5'
|
349
349
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
350
350
|
requirements:
|
351
351
|
- - ">="
|
352
352
|
- !ruby/object:Gem::Version
|
353
353
|
version: '0'
|
354
354
|
requirements: []
|
355
|
-
|
356
|
-
|
357
|
-
signing_key:
|
355
|
+
rubygems_version: 3.1.3
|
356
|
+
signing_key:
|
358
357
|
specification_version: 4
|
359
358
|
summary: An opinionated Ruby interface to the Zuora API.
|
360
359
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
cache: bundler
|
2
|
-
|
3
|
-
language: ruby
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- 2.4.6
|
7
|
-
- 2.5.5
|
8
|
-
- 2.6.2
|
9
|
-
|
10
|
-
sudo: false
|
11
|
-
|
12
|
-
branches:
|
13
|
-
only: master
|
14
|
-
|
15
|
-
before_install:
|
16
|
-
- gem update --system
|
17
|
-
- gem install bundler --no-document
|
18
|
-
|
19
|
-
env:
|
20
|
-
global:
|
21
|
-
- ZUORA_CLIENT_ID=something
|
22
|
-
- ZUORA_CLIENT_SECRET=secret
|
23
|
-
- ZUORA_DOMAIN=rest.apisandbox.zuora.com
|