iron_bank 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.example +0 -2
- data/.gitignore +0 -1
- data/.reek.yml +5 -15
- data/.rspec +1 -0
- data/.rubocop.yml +9 -4
- data/.ruby-version +1 -0
- data/.travis.yml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +134 -0
- data/README.md +34 -14
- data/Rakefile +11 -16
- data/bin/console +8 -8
- data/iron_bank.gemspec +32 -34
- data/lib/generators/iron_bank/install/install_generator.rb +4 -4
- data/lib/generators/iron_bank/install/templates/iron_bank.rb +6 -6
- data/lib/iron_bank/action.rb +1 -1
- data/lib/iron_bank/actions/query_more.rb +1 -1
- data/lib/iron_bank/associations.rb +2 -2
- data/lib/iron_bank/authentication.rb +1 -1
- data/lib/iron_bank/authentications/cookie.rb +7 -7
- data/lib/iron_bank/authentications/token.rb +9 -9
- data/lib/iron_bank/cacheable.rb +1 -0
- data/lib/iron_bank/client.rb +6 -10
- data/lib/iron_bank/collection.rb +1 -0
- data/lib/iron_bank/configuration.rb +8 -19
- data/lib/iron_bank/csv.rb +2 -2
- data/lib/iron_bank/describe/field.rb +2 -2
- data/lib/iron_bank/describe/object.rb +5 -5
- data/lib/iron_bank/describe/related.rb +3 -3
- data/lib/iron_bank/describe/tenant.rb +2 -2
- data/lib/iron_bank/endpoint.rb +3 -3
- data/lib/iron_bank/error.rb +17 -17
- data/lib/iron_bank/local.rb +15 -7
- data/lib/iron_bank/local_records.rb +58 -20
- data/lib/iron_bank/logger.rb +3 -3
- data/lib/iron_bank/operation.rb +1 -1
- data/lib/iron_bank/query_builder.rb +4 -4
- data/lib/iron_bank/resource.rb +2 -7
- data/lib/iron_bank/resources/account.rb +6 -6
- data/lib/iron_bank/resources/export.rb +23 -0
- data/lib/iron_bank/resources/product_rate_plan.rb +2 -1
- data/lib/iron_bank/resources/product_rate_plan_charge_tier.rb +0 -44
- data/lib/iron_bank/resources/rate_plan_charge.rb +1 -1
- data/lib/iron_bank/resources/subscription.rb +4 -4
- data/lib/iron_bank/resources/usage.rb +1 -1
- data/lib/iron_bank/utils.rb +5 -5
- data/lib/iron_bank/version.rb +2 -2
- data/lib/iron_bank.rb +67 -75
- metadata +21 -52
- data/lib/iron_bank/instrumentation.rb +0 -14
- data/lib/iron_bank/open_tracing.rb +0 -18
- data/lib/iron_bank/resources/catalog_tiers/discount_amount.rb +0 -26
- data/lib/iron_bank/resources/catalog_tiers/discount_percentage.rb +0 -26
- data/lib/iron_bank/resources/catalog_tiers/price.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd0a8bbdf58674ed00c1fae75779154686d68169
|
4
|
+
data.tar.gz: 3e717805b232af39c08d5a25fced3a37695575e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f3095ab197020b4c66cdc90cfdf92778468d94d091f757cd1aa2fc08ca8bfbd1aad0b6c67a5ed9b254d0f4628ba3ad37c27f92368f9452d342dd06631284636
|
7
|
+
data.tar.gz: d64a053dbb6d9d1de5fdad2eddfab54a5e37b90ebee73ee06c168465a5396b9f73fd0726be315a5a731cf950f506d82b00d4f8849d40a0d229ad4b36cf59336f
|
data/.env.example
CHANGED
data/.gitignore
CHANGED
data/.reek.yml
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
---
|
2
|
-
|
3
2
|
# Exclude vendor/bundle directory for Travis
|
4
3
|
exclude_paths:
|
5
4
|
- vendor/bundle
|
@@ -15,12 +14,8 @@ detectors:
|
|
15
14
|
- IronBank::Configuration#client_secret
|
16
15
|
- IronBank::Configuration#domain
|
17
16
|
- IronBank::Configuration#export_directory
|
18
|
-
- IronBank::Configuration#instrumenter
|
19
|
-
- IronBank::Configuration#instrumenter_options
|
20
17
|
- IronBank::Configuration#logger
|
21
|
-
- IronBank::Configuration#
|
22
|
-
- IronBank::Configuration#open_tracing_service_name
|
23
|
-
- IronBank::Configuration#retry_options
|
18
|
+
- IronBank::Configuration#middlewares
|
24
19
|
- IronBank::Configuration#schema_directory
|
25
20
|
|
26
21
|
BooleanParameter:
|
@@ -43,6 +38,7 @@ detectors:
|
|
43
38
|
- IronBank::Object#underscore
|
44
39
|
- IronBank::Actions::Subscribe#hash_args
|
45
40
|
- IronBank::Utils#camelize
|
41
|
+
- IronBank::Local#underscore_header
|
46
42
|
|
47
43
|
InstanceVariableAssumption:
|
48
44
|
exclude:
|
@@ -60,9 +56,11 @@ detectors:
|
|
60
56
|
exclude:
|
61
57
|
- IronBank::Schema#self.import
|
62
58
|
- IronBank::Local#where
|
63
|
-
- IronBank::Local#load_records
|
64
59
|
- IronBank::LocalRecords#export
|
65
60
|
- IronBank::Resources::ProductRatePlanChargeTier#self.load_records
|
61
|
+
- IronBank::Client#connection
|
62
|
+
- IronBank::Authentications::Token#connection
|
63
|
+
- IronBank::Authentications::Cookie#connection
|
66
64
|
|
67
65
|
NilCheck:
|
68
66
|
enabled: false
|
@@ -89,20 +87,12 @@ detectors:
|
|
89
87
|
- IronBank::Resources::ProductRatePlanChargeTier#self.load_records
|
90
88
|
- IronBank::Error#self.from_response
|
91
89
|
|
92
|
-
UncommunicativeVariableName:
|
93
|
-
exclude:
|
94
|
-
- IronBank::Local#csv_options
|
95
|
-
|
96
90
|
UtilityFunction:
|
97
91
|
exclude:
|
98
92
|
- IronBank::Cacheable::ClassMethods#cache
|
99
93
|
- IronBank::Object#convert
|
100
94
|
- IronBank::Object#camelize_array
|
101
95
|
- IronBank::Object#underscore_array
|
102
|
-
- IronBank::OpenTracing#open_tracing_enabled?
|
103
|
-
- IronBank::OpenTracing#open_tracing_options
|
104
96
|
- IronBank::QueryBuilder#range_query_builder
|
105
97
|
- IronBank::Utils#lower_camelize
|
106
98
|
- IronBank::Utils#upper_camelize
|
107
|
-
- IronBank::Instrumentation#instrumenter
|
108
|
-
- IronBank::Instrumentation#instrumenter_options
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require: rubocop-performance
|
2
|
+
|
1
3
|
AllCops:
|
2
4
|
DisplayCopNames: true
|
3
5
|
DisplayStyleGuide: true
|
4
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.4
|
5
7
|
|
6
8
|
Layout/DotPosition:
|
7
9
|
EnforcedStyle: trailing
|
@@ -44,6 +46,10 @@ Metrics/LineLength:
|
|
44
46
|
Style/ClassAndModuleChildren:
|
45
47
|
EnforcedStyle: nested
|
46
48
|
|
49
|
+
Style/MixinUsage:
|
50
|
+
Exclude:
|
51
|
+
- lib/iron_bank/resource.rb
|
52
|
+
|
47
53
|
Style/OptionalArguments:
|
48
54
|
Exclude:
|
49
55
|
- lib/iron_bank/local.rb
|
@@ -54,6 +60,5 @@ Style/RescueStandardError:
|
|
54
60
|
Exclude:
|
55
61
|
- lib/iron_bank/csv.rb
|
56
62
|
|
57
|
-
Style/
|
58
|
-
|
59
|
-
- lib/iron_bank/resource.rb
|
63
|
+
Style/StringLiterals:
|
64
|
+
EnforcedStyle: double_quotes
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.6
|
data/.travis.yml
CHANGED
@@ -3,9 +3,9 @@ cache: bundler
|
|
3
3
|
language: ruby
|
4
4
|
|
5
5
|
rvm:
|
6
|
-
- 2.
|
7
|
-
- 2.
|
8
|
-
- 2.
|
6
|
+
- 2.4.6
|
7
|
+
- 2.5.5
|
8
|
+
- 2.6.2
|
9
9
|
|
10
10
|
sudo: false
|
11
11
|
|
@@ -14,7 +14,7 @@ branches:
|
|
14
14
|
|
15
15
|
before_install:
|
16
16
|
- gem update --system
|
17
|
-
- gem install bundler
|
17
|
+
- gem install bundler --no-document
|
18
18
|
|
19
19
|
env:
|
20
20
|
global:
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
iron_bank (3.0.0)
|
5
|
+
faraday (~> 0)
|
6
|
+
faraday_middleware (~> 0)
|
7
|
+
nokogiri (~> 1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (5.2.3)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
ast (2.4.0)
|
18
|
+
axiom-types (0.1.1)
|
19
|
+
descendants_tracker (~> 0.0.4)
|
20
|
+
ice_nine (~> 0.11.0)
|
21
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
22
|
+
bump (0.8.0)
|
23
|
+
byebug (11.0.1)
|
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)
|
33
|
+
docile (1.3.1)
|
34
|
+
dotenv (2.7.2)
|
35
|
+
equalizer (0.0.11)
|
36
|
+
factory_bot (5.0.2)
|
37
|
+
activesupport (>= 4.2.0)
|
38
|
+
faraday (0.15.4)
|
39
|
+
multipart-post (>= 1.2, < 3)
|
40
|
+
faraday_middleware (0.13.1)
|
41
|
+
faraday (>= 0.7.4, < 1.0)
|
42
|
+
i18n (1.6.0)
|
43
|
+
concurrent-ruby (~> 1.0)
|
44
|
+
ice_nine (0.11.2)
|
45
|
+
jaro_winkler (1.5.2)
|
46
|
+
json (2.2.0)
|
47
|
+
kwalify (0.7.2)
|
48
|
+
method_source (0.9.2)
|
49
|
+
mini_portile2 (2.4.0)
|
50
|
+
minitest (5.11.3)
|
51
|
+
multipart-post (2.0.0)
|
52
|
+
nokogiri (1.10.2)
|
53
|
+
mini_portile2 (~> 2.4.0)
|
54
|
+
parallel (1.17.0)
|
55
|
+
parser (2.6.2.1)
|
56
|
+
ast (~> 2.4.0)
|
57
|
+
pry (0.12.2)
|
58
|
+
coderay (~> 1.1.0)
|
59
|
+
method_source (~> 0.9.0)
|
60
|
+
pry-byebug (3.7.0)
|
61
|
+
byebug (~> 11.0)
|
62
|
+
pry (~> 0.10)
|
63
|
+
psych (3.1.0)
|
64
|
+
rainbow (3.0.0)
|
65
|
+
rake (12.3.2)
|
66
|
+
reek (5.3.2)
|
67
|
+
codeclimate-engine-rb (~> 0.4.0)
|
68
|
+
kwalify (~> 0.7.0)
|
69
|
+
parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
|
70
|
+
psych (~> 3.1.0)
|
71
|
+
rainbow (>= 2.0, < 4.0)
|
72
|
+
rspec (3.8.0)
|
73
|
+
rspec-core (~> 3.8.0)
|
74
|
+
rspec-expectations (~> 3.8.0)
|
75
|
+
rspec-mocks (~> 3.8.0)
|
76
|
+
rspec-core (3.8.0)
|
77
|
+
rspec-support (~> 3.8.0)
|
78
|
+
rspec-expectations (3.8.2)
|
79
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
+
rspec-support (~> 3.8.0)
|
81
|
+
rspec-mocks (3.8.0)
|
82
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
+
rspec-support (~> 3.8.0)
|
84
|
+
rspec-support (3.8.0)
|
85
|
+
rubocop (0.67.2)
|
86
|
+
jaro_winkler (~> 1.5.1)
|
87
|
+
parallel (~> 1.10)
|
88
|
+
parser (>= 2.5, != 2.5.1.1)
|
89
|
+
psych (>= 3.1.0)
|
90
|
+
rainbow (>= 2.2.2, < 4.0)
|
91
|
+
ruby-progressbar (~> 1.7)
|
92
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
93
|
+
rubocop-performance (1.0.0)
|
94
|
+
rubocop (>= 0.58.0)
|
95
|
+
ruby-progressbar (1.10.0)
|
96
|
+
shoulda-matchers (4.0.1)
|
97
|
+
activesupport (>= 4.2.0)
|
98
|
+
simplecov (0.16.1)
|
99
|
+
docile (~> 1.1)
|
100
|
+
json (>= 1.8, < 3)
|
101
|
+
simplecov-html (~> 0.10.0)
|
102
|
+
simplecov-html (0.10.2)
|
103
|
+
thread_safe (0.3.6)
|
104
|
+
timecop (0.9.1)
|
105
|
+
tzinfo (1.2.5)
|
106
|
+
thread_safe (~> 0.1)
|
107
|
+
unicode-display_width (1.5.0)
|
108
|
+
virtus (1.0.5)
|
109
|
+
axiom-types (~> 0.1)
|
110
|
+
coercible (~> 1.0)
|
111
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
112
|
+
equalizer (~> 0.0, >= 0.0.9)
|
113
|
+
|
114
|
+
PLATFORMS
|
115
|
+
ruby
|
116
|
+
|
117
|
+
DEPENDENCIES
|
118
|
+
bump (~> 0.5)
|
119
|
+
bundler (~> 2.0)
|
120
|
+
dotenv (~> 2.2)
|
121
|
+
factory_bot (~> 5.0)
|
122
|
+
iron_bank!
|
123
|
+
pry-byebug (~> 3.4)
|
124
|
+
rake (~> 12.0)
|
125
|
+
reek (~> 5.0)
|
126
|
+
rspec (~> 3.0)
|
127
|
+
rubocop (~> 0.67)
|
128
|
+
rubocop-performance (~> 1.0)
|
129
|
+
shoulda-matchers (~> 4.0)
|
130
|
+
simplecov (~> 0.15)
|
131
|
+
timecop (~> 0.9.0)
|
132
|
+
|
133
|
+
BUNDLED WITH
|
134
|
+
2.0.1
|
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.4`.
|
17
17
|
|
18
18
|
Please use [GitHub Issues][issues] to report bugs.
|
19
19
|
|
@@ -31,7 +31,7 @@ configuration) when using it within [Rails][rails-website].
|
|
31
31
|
|
32
32
|
Add the gem to your `Gemfile` with:
|
33
33
|
|
34
|
-
```
|
34
|
+
```rb
|
35
35
|
gem 'iron_bank'
|
36
36
|
```
|
37
37
|
|
@@ -44,9 +44,31 @@ $ rails generate iron_bank:install
|
|
44
44
|
Use the `client_id` and `client_secret` from your Zuora OAuth client and add
|
45
45
|
them to the generated `config/initializers/iron_bank.rb` file.
|
46
46
|
|
47
|
+
## Configuration
|
48
|
+
|
49
|
+
```rb
|
50
|
+
# Configure Ironbank
|
51
|
+
IronBank.configure do |config|
|
52
|
+
config.client_id = 'client_id'
|
53
|
+
config.client_secret = 'client_secret'
|
54
|
+
config.auth_type = 'auth_type'
|
55
|
+
config.domain = 'zuora-domain' # zuora doamin
|
56
|
+
config.export_directory = 'directory-path' # export directory path
|
57
|
+
config.schema_directory = 'directory-path' # schema drirectory path
|
58
|
+
|
59
|
+
# Ironbank uses Faraday to send request to Zuora. Middlewares can be specified
|
60
|
+
# by adding the class name and class options to the `middlewares`
|
61
|
+
# configuration.
|
62
|
+
# Faraday middlewares, we can send in an array with cutomer middleware class
|
63
|
+
# and options
|
64
|
+
config.middlewares << [DummyMiddlewareClass, {}]
|
65
|
+
end
|
66
|
+
|
67
|
+
```
|
68
|
+
|
47
69
|
## Usage
|
48
70
|
|
49
|
-
```
|
71
|
+
```rb
|
50
72
|
# make a query to Zuora using ZOQL
|
51
73
|
IronBank::Query.call "select Name from Account where Id='zuora-account-id'"
|
52
74
|
|
@@ -73,7 +95,7 @@ it locally so that product catalog and related object queries look for
|
|
73
95
|
|
74
96
|
You can export your product catalog locally using the `LocalRecords` class:
|
75
97
|
|
76
|
-
```
|
98
|
+
```rb
|
77
99
|
# Save CSV files in the directory specified by `config.export_directory`
|
78
100
|
IronBank::LocalRecords.export
|
79
101
|
```
|
@@ -81,7 +103,7 @@ IronBank::LocalRecords.export
|
|
81
103
|
Then, making a query/looking for a record will first search through the local
|
82
104
|
records, then default to the API if no records are found.
|
83
105
|
|
84
|
-
```
|
106
|
+
```rb
|
85
107
|
product = IronBank::Product.find 'zuora-product-id'
|
86
108
|
# => #<IronBank::Resources::Product>
|
87
109
|
|
@@ -112,7 +134,6 @@ https://github.com/zendesk/iron_bank.
|
|
112
134
|
the metadata showing `<selectable>true</selectable>`, hence it has been added
|
113
135
|
to the `exclude_fields` method.
|
114
136
|
|
115
|
-
|
116
137
|
## Copyright and license
|
117
138
|
|
118
139
|
Copyright 2018 Zendesk, Inc.
|
@@ -128,12 +149,11 @@ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
128
149
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
129
150
|
specific language governing permissions and limitations under the License.
|
130
151
|
|
131
|
-
|
132
|
-
[
|
133
|
-
[travis-
|
134
|
-
[
|
135
|
-
[zuora-
|
136
|
-
[zuora-dev]: https://developer.zuora.com
|
152
|
+
[issues]: https://github.com/zendesk/iron_bank/issues
|
153
|
+
[travis-status]: https://travis-ci.com/zendesk/iron_bank.svg?token=Qzkq5papoR7sdedznjeb&branch=master
|
154
|
+
[travis-build]: https://travis-ci.com/zendesk/iron_bank
|
155
|
+
[zuora-describe]: https://www.zuora.com/developer/api-reference/#tag/Describe
|
156
|
+
[zuora-dev]: https://developer.zuora.com
|
137
157
|
[zuora-doc-oauth]: https://knowledgecenter.zuora.com/CF_Users_and_Administrators/A_Administrator_Settings/Manage_Users#Create_an_OAuth_Client_for_a_User
|
138
|
-
[zuora-website]:
|
139
|
-
[rails-website]:
|
158
|
+
[zuora-website]: https://www.zuora.com
|
159
|
+
[rails-website]: https://rubyonrails.org/
|
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "reek/rake/task"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
require "bump/tasks"
|
7
7
|
|
8
8
|
Reek::Rake::Task.new do |reek|
|
9
9
|
reek.fail_on_error = true
|
@@ -19,22 +19,17 @@ task test: :spec
|
|
19
19
|
|
20
20
|
task default: %i[rubocop reek spec]
|
21
21
|
|
22
|
-
desc
|
23
|
-
task :clean do
|
24
|
-
sh 'rm -rf spec/vcr'
|
25
|
-
end
|
26
|
-
|
27
|
-
desc 'Export the Zuora Schema using the Describe API'
|
22
|
+
desc "Export the Zuora Schema using the Describe API"
|
28
23
|
task :export_schema do
|
29
|
-
require
|
30
|
-
require
|
24
|
+
require "dotenv/load"
|
25
|
+
require "iron_bank"
|
31
26
|
|
32
27
|
# Set up the client
|
33
28
|
IronBank.client = IronBank::Client.new(
|
34
|
-
domain: ENV[
|
35
|
-
client_id: ENV[
|
36
|
-
client_secret: ENV[
|
37
|
-
auth_type: ENV[
|
29
|
+
domain: ENV["ZUORA_DOMAIN"],
|
30
|
+
client_id: ENV["ZUORA_CLIENT_ID"],
|
31
|
+
client_secret: ENV["ZUORA_CLIENT_SECRET"],
|
32
|
+
auth_type: ENV["ZUORA_AUTH_TYPE"]
|
38
33
|
)
|
39
34
|
|
40
35
|
IronBank::Schema.export
|
data/bin/console
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
4
|
+
require "dotenv/load"
|
5
|
+
require "bundler/setup"
|
6
|
+
require "iron_bank"
|
7
|
+
require "pry-byebug"
|
8
8
|
|
9
9
|
credentials = {
|
10
|
-
domain: ENV[
|
11
|
-
client_id: ENV[
|
12
|
-
client_secret: ENV[
|
13
|
-
auth_type: ENV[
|
10
|
+
domain: ENV["ZUORA_DOMAIN"],
|
11
|
+
client_id: ENV["ZUORA_CLIENT_ID"],
|
12
|
+
client_secret: ENV["ZUORA_CLIENT_SECRET"],
|
13
|
+
auth_type: ENV["ZUORA_AUTH_TYPE"]
|
14
14
|
}
|
15
15
|
|
16
16
|
# If credentials are present in environment variables
|
data/iron_bank.gemspec
CHANGED
@@ -1,51 +1,49 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require "iron_bank/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name =
|
8
|
+
spec.name = "iron_bank"
|
9
9
|
spec.version = IronBank::VERSION
|
10
|
-
spec.summary =
|
11
|
-
spec.homepage =
|
12
|
-
spec.license =
|
13
|
-
spec.authors = [
|
10
|
+
spec.summary = "An opinionated Ruby interface to the Zuora API."
|
11
|
+
spec.homepage = "https://github.com/zendesk/iron_bank"
|
12
|
+
spec.license = "Apache-2.0"
|
13
|
+
spec.authors = ["Mickael Pham", "Cheng Cui", "Ryan Ringler", "Mustafa Turan"]
|
14
14
|
|
15
15
|
spec.email = [
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
"mickael@zendesk.com",
|
17
|
+
"ccui@zendesk.com",
|
18
|
+
"rringler@zendesk.com",
|
19
|
+
"mturan@zendesk.com"
|
20
20
|
]
|
21
21
|
|
22
|
-
spec.required_ruby_version =
|
22
|
+
spec.required_ruby_version = ">= 2.4"
|
23
23
|
|
24
24
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
25
|
f.match(%r{^(test|spec|features)/})
|
26
26
|
end
|
27
27
|
|
28
|
-
spec.bindir =
|
28
|
+
spec.bindir = "exe"
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
-
spec.require_paths = [
|
31
|
-
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
34
|
-
spec.add_development_dependency
|
35
|
-
spec.add_development_dependency
|
36
|
-
spec.add_development_dependency
|
37
|
-
spec.add_development_dependency
|
38
|
-
spec.add_development_dependency
|
39
|
-
spec.add_development_dependency
|
40
|
-
spec.add_development_dependency
|
41
|
-
spec.add_development_dependency
|
42
|
-
spec.add_development_dependency
|
43
|
-
spec.add_development_dependency
|
44
|
-
spec.add_development_dependency
|
45
|
-
|
46
|
-
|
47
|
-
spec.
|
48
|
-
spec.
|
49
|
-
spec.add_dependency 'faraday_middleware', '~> 0'
|
50
|
-
spec.add_dependency 'nokogiri', '~> 1'
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency "bump", "~> 0.5"
|
33
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
34
|
+
spec.add_development_dependency "dotenv", "~> 2.2"
|
35
|
+
spec.add_development_dependency "factory_bot", "~> 5.0"
|
36
|
+
spec.add_development_dependency "pry-byebug", "~> 3.4"
|
37
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
38
|
+
spec.add_development_dependency "reek", "~> 5.0"
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
+
spec.add_development_dependency "rubocop", "~> 0.67"
|
41
|
+
spec.add_development_dependency "rubocop-performance", "~> 1.0"
|
42
|
+
spec.add_development_dependency "shoulda-matchers", "~> 4.0"
|
43
|
+
spec.add_development_dependency "simplecov", "~> 0.15"
|
44
|
+
spec.add_development_dependency "timecop", "~> 0.9.0"
|
45
|
+
|
46
|
+
spec.add_runtime_dependency "faraday", "~> 0"
|
47
|
+
spec.add_runtime_dependency "faraday_middleware", "~> 0"
|
48
|
+
spec.add_runtime_dependency "nokogiri", "~> 1"
|
51
49
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "rails/generators/base"
|
4
4
|
|
5
5
|
module IronBank
|
6
6
|
module Generators
|
7
7
|
# Allow us to run `rails generate iron_bank:install`
|
8
8
|
class InstallGenerator < Rails::Generators::Base
|
9
|
-
source_root File.expand_path(
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
10
10
|
|
11
11
|
def create_iron_bank_initializer
|
12
|
-
copy_file
|
12
|
+
copy_file "iron_bank.rb", "config/initializers/iron_bank.rb"
|
13
13
|
end
|
14
14
|
|
15
15
|
def display_readme_in_terminal
|
16
|
-
readme
|
16
|
+
readme "README"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
IronBank.configure do |config|
|
4
4
|
# Zuora OAuth client ID
|
5
|
-
config.client_id =
|
5
|
+
config.client_id = "<my-client-id-from-zuora>"
|
6
6
|
|
7
7
|
# Zuora OAuth client secret
|
8
|
-
config.client_secret =
|
8
|
+
config.client_secret = "<my-secret-from-zuora>"
|
9
9
|
|
10
10
|
# Zuora API domain (apisandbox, production, etc.)
|
11
|
-
config.domain =
|
11
|
+
config.domain = "rest.apisandbox.zuora.com"
|
12
12
|
|
13
13
|
# Directory where the metadata XML files (Zuora schema) will be stored
|
14
|
-
config.schema_directory =
|
14
|
+
config.schema_directory = "config/zuora/schema"
|
15
15
|
|
16
16
|
# Directory where the local export CSV files will be stored
|
17
|
-
config.export_directory =
|
17
|
+
config.export_directory = "config/zuora/local_records"
|
18
18
|
|
19
19
|
# Zuora authentication type:
|
20
20
|
# - `token` uses OAuth and is the *recommended* approach
|
@@ -22,7 +22,7 @@ IronBank.configure do |config|
|
|
22
22
|
# support OAuth authentication, e.g., services environment. If
|
23
23
|
# using `cookie` authentication, then use an API user username as
|
24
24
|
# the `client_id` and the API user password as `client_secret`
|
25
|
-
config.auth_type =
|
25
|
+
config.auth_type = "token"
|
26
26
|
|
27
27
|
# Set the gem to use the Rails logger
|
28
28
|
config.logger = Rails.logger
|
data/lib/iron_bank/action.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.to_s +
|
15
|
+
foreign_key = options.fetch(:foreign_key, name.to_s + "_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
|