iron_bank 3.3.4 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +21 -22
- data/iron_bank.gemspec +1 -1
- data/lib/iron_bank/actions/query.rb +8 -1
- data/lib/iron_bank/cacheable.rb +2 -1
- data/lib/iron_bank/local.rb +5 -1
- data/lib/iron_bank/queryable.rb +12 -9
- data/lib/iron_bank/utils.rb +1 -1
- data/lib/iron_bank/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 195ba10f5c39626868e1d281972ff45e4618f1e72b0d87684aa9c65d1ed1fa10
|
4
|
+
data.tar.gz: acd56eae404df5027aceeb8081b542da811178a71ff56924531b4d2280fa045d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4db1e53ef118e2b496a1ae41ea0f880458386767e57a562de235f0e734416df59f441c7f1928aca06cfa3904c49623985a794f5b3bf72121391488c2dc1a1da4
|
7
|
+
data.tar.gz: 25c9457c4716177d3a21d0f6b993a433558a323a6ba8f63e4cca881660ddca92408a16226d6ae4e42f05f6d280c6340c42c2667a8a2c131afc0a3adee9acd05d
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
iron_bank (3.
|
4
|
+
iron_bank (3.4.0)
|
5
5
|
faraday (~> 0)
|
6
6
|
faraday_middleware (~> 0)
|
7
7
|
nokogiri (~> 1)
|
@@ -30,8 +30,8 @@ GEM
|
|
30
30
|
descendants_tracker (0.0.4)
|
31
31
|
thread_safe (~> 0.3, >= 0.3.1)
|
32
32
|
diff-lcs (1.3)
|
33
|
-
docile (1.3.
|
34
|
-
dotenv (2.7.
|
33
|
+
docile (1.3.2)
|
34
|
+
dotenv (2.7.5)
|
35
35
|
equalizer (0.0.11)
|
36
36
|
factory_bot (5.0.2)
|
37
37
|
activesupport (>= 4.2.0)
|
@@ -42,7 +42,7 @@ GEM
|
|
42
42
|
i18n (1.6.0)
|
43
43
|
concurrent-ruby (~> 1.0)
|
44
44
|
ice_nine (0.11.2)
|
45
|
-
jaro_winkler (1.5.
|
45
|
+
jaro_winkler (1.5.3)
|
46
46
|
json (2.2.0)
|
47
47
|
kwalify (0.7.2)
|
48
48
|
method_source (0.9.2)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
nokogiri (1.10.4)
|
53
53
|
mini_portile2 (~> 2.4.0)
|
54
54
|
parallel (1.17.0)
|
55
|
-
parser (2.6.
|
55
|
+
parser (2.6.3.0)
|
56
56
|
ast (~> 2.4.0)
|
57
57
|
pry (0.12.2)
|
58
58
|
coderay (~> 1.1.0)
|
@@ -62,8 +62,8 @@ GEM
|
|
62
62
|
pry (~> 0.10)
|
63
63
|
psych (3.1.0)
|
64
64
|
rainbow (3.0.0)
|
65
|
-
rake (12.3.
|
66
|
-
reek (5.
|
65
|
+
rake (12.3.3)
|
66
|
+
reek (5.4.0)
|
67
67
|
codeclimate-engine-rb (~> 0.4.0)
|
68
68
|
kwalify (~> 0.7.0)
|
69
69
|
parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
|
@@ -73,29 +73,28 @@ GEM
|
|
73
73
|
rspec-core (~> 3.8.0)
|
74
74
|
rspec-expectations (~> 3.8.0)
|
75
75
|
rspec-mocks (~> 3.8.0)
|
76
|
-
rspec-core (3.8.
|
76
|
+
rspec-core (3.8.2)
|
77
77
|
rspec-support (~> 3.8.0)
|
78
|
-
rspec-expectations (3.8.
|
78
|
+
rspec-expectations (3.8.4)
|
79
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
80
|
rspec-support (~> 3.8.0)
|
81
|
-
rspec-mocks (3.8.
|
81
|
+
rspec-mocks (3.8.1)
|
82
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
83
|
rspec-support (~> 3.8.0)
|
84
|
-
rspec-support (3.8.
|
85
|
-
rubocop (0.
|
84
|
+
rspec-support (3.8.2)
|
85
|
+
rubocop (0.74.0)
|
86
86
|
jaro_winkler (~> 1.5.1)
|
87
87
|
parallel (~> 1.10)
|
88
|
-
parser (>= 2.
|
89
|
-
psych (>= 3.1.0)
|
88
|
+
parser (>= 2.6)
|
90
89
|
rainbow (>= 2.2.2, < 4.0)
|
91
90
|
ruby-progressbar (~> 1.7)
|
92
|
-
unicode-display_width (>= 1.4.0, < 1.
|
93
|
-
rubocop-performance (1.
|
94
|
-
rubocop (>= 0.
|
95
|
-
ruby-progressbar (1.10.
|
96
|
-
shoulda-matchers (4.
|
91
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
92
|
+
rubocop-performance (1.4.1)
|
93
|
+
rubocop (>= 0.71.0)
|
94
|
+
ruby-progressbar (1.10.1)
|
95
|
+
shoulda-matchers (4.1.2)
|
97
96
|
activesupport (>= 4.2.0)
|
98
|
-
simplecov (0.
|
97
|
+
simplecov (0.17.0)
|
99
98
|
docile (~> 1.1)
|
100
99
|
json (>= 1.8, < 3)
|
101
100
|
simplecov-html (~> 0.10.0)
|
@@ -104,7 +103,7 @@ GEM
|
|
104
103
|
timecop (0.9.1)
|
105
104
|
tzinfo (1.2.5)
|
106
105
|
thread_safe (~> 0.1)
|
107
|
-
unicode-display_width (1.
|
106
|
+
unicode-display_width (1.6.0)
|
108
107
|
virtus (1.0.5)
|
109
108
|
axiom-types (~> 0.1)
|
110
109
|
coercible (~> 1.0)
|
@@ -128,7 +127,7 @@ DEPENDENCIES
|
|
128
127
|
rubocop-performance (~> 1.0)
|
129
128
|
shoulda-matchers (~> 4.0)
|
130
129
|
simplecov (~> 0.15)
|
131
|
-
timecop (~> 0.9
|
130
|
+
timecop (~> 0.9)
|
132
131
|
|
133
132
|
BUNDLED WITH
|
134
133
|
2.0.2
|
data/iron_bank.gemspec
CHANGED
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.add_development_dependency "rubocop-performance", "~> 1.0"
|
42
42
|
spec.add_development_dependency "shoulda-matchers", "~> 4.0"
|
43
43
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
44
|
-
spec.add_development_dependency "timecop", "~> 0.9
|
44
|
+
spec.add_development_dependency "timecop", "~> 0.9"
|
45
45
|
|
46
46
|
spec.add_runtime_dependency "faraday", "~> 0"
|
47
47
|
spec.add_runtime_dependency "faraday_middleware", "~> 0"
|
@@ -6,7 +6,14 @@ module IronBank
|
|
6
6
|
# https://knowledgecenter.zuora.com/DC_Developers/K_Zuora_Object_Query_Language
|
7
7
|
#
|
8
8
|
class Query < Action
|
9
|
-
|
9
|
+
# Zuora's default is 2,000 records, but we simply use `0` here to not pass
|
10
|
+
# the parameter to Zuora APIs during the query call.
|
11
|
+
#
|
12
|
+
# See https://knowledgecenter.zuora.com/DC_Developers/BC_ZOQL#Limits
|
13
|
+
#
|
14
|
+
DEFAULT_ZUORA_LIMIT = 0
|
15
|
+
|
16
|
+
def self.call(zoql, limit: DEFAULT_ZUORA_LIMIT)
|
10
17
|
new(zoql, limit).call
|
11
18
|
end
|
12
19
|
|
data/lib/iron_bank/cacheable.rb
CHANGED
@@ -32,7 +32,8 @@ module IronBank
|
|
32
32
|
cache.fetch(id, force: force) { super(id) }
|
33
33
|
end
|
34
34
|
|
35
|
-
def where(conditions
|
35
|
+
def where(conditions,
|
36
|
+
limit: IronBank::Actions::Query::DEFAULT_ZUORA_LIMIT)
|
36
37
|
# Conditions can be empty when called from #all, it does not make sense
|
37
38
|
# to try to cache all records returned then.
|
38
39
|
return super if conditions.empty?
|
data/lib/iron_bank/local.rb
CHANGED
@@ -19,7 +19,11 @@ module IronBank
|
|
19
19
|
store.any? ? store.values : super
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def first
|
23
|
+
store.any? ? store.values.first : super
|
24
|
+
end
|
25
|
+
|
26
|
+
def where(conditions, limit: IronBank::Actions::Query::DEFAULT_ZUORA_LIMIT)
|
23
27
|
records = store.values.select do |record|
|
24
28
|
conditions.all? { |field, value| record.public_send(field) == value }
|
25
29
|
end
|
data/lib/iron_bank/queryable.rb
CHANGED
@@ -17,6 +17,9 @@ module IronBank
|
|
17
17
|
|
18
18
|
# This methods leverages the fact that Zuora only returns 2,000 records at a
|
19
19
|
# time, hance providing a default batch size
|
20
|
+
#
|
21
|
+
# See https://knowledgecenter.zuora.com/DC_Developers/BC_ZOQL#Limits
|
22
|
+
#
|
20
23
|
def find_each
|
21
24
|
return enum_for(:find_each) unless block_given?
|
22
25
|
|
@@ -36,17 +39,17 @@ module IronBank
|
|
36
39
|
where({})
|
37
40
|
end
|
38
41
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
def first
|
43
|
+
where({}, limit: 1).first
|
44
|
+
end
|
45
|
+
|
46
|
+
def where(conditions, limit: IronBank::Actions::Query::DEFAULT_ZUORA_LIMIT)
|
47
|
+
query_string = IronBank::QueryBuilder.
|
48
|
+
zoql(object_name, query_fields, conditions)
|
45
49
|
|
46
|
-
|
47
|
-
# puts "query: #{query_string}"
|
50
|
+
IronBank.logger.info "query: #{query_string}"
|
48
51
|
|
49
|
-
records = IronBank::Query.call(query_string)[:records]
|
52
|
+
records = IronBank::Query.call(query_string, limit: limit)[:records]
|
50
53
|
return [] unless records
|
51
54
|
|
52
55
|
records.each.with_object([]) do |data, result|
|
data/lib/iron_bank/utils.rb
CHANGED
@@ -8,7 +8,7 @@ module IronBank
|
|
8
8
|
|
9
9
|
# Inspired from ActiveSupport
|
10
10
|
def underscore(camel_cased_word)
|
11
|
-
return camel_cased_word unless
|
11
|
+
return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)
|
12
12
|
|
13
13
|
word = camel_cased_word.to_s.gsub(/::/, "/")
|
14
14
|
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
data/lib/iron_bank/version.rb
CHANGED
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: 3.
|
4
|
+
version: 3.4.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: 2019-
|
14
|
+
date: 2019-09-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bump
|
@@ -187,14 +187,14 @@ dependencies:
|
|
187
187
|
requirements:
|
188
188
|
- - "~>"
|
189
189
|
- !ruby/object:Gem::Version
|
190
|
-
version: 0.9
|
190
|
+
version: '0.9'
|
191
191
|
type: :development
|
192
192
|
prerelease: false
|
193
193
|
version_requirements: !ruby/object:Gem::Requirement
|
194
194
|
requirements:
|
195
195
|
- - "~>"
|
196
196
|
- !ruby/object:Gem::Version
|
197
|
-
version: 0.9
|
197
|
+
version: '0.9'
|
198
198
|
- !ruby/object:Gem::Dependency
|
199
199
|
name: faraday
|
200
200
|
requirement: !ruby/object:Gem::Requirement
|
@@ -349,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
349
349
|
- !ruby/object:Gem::Version
|
350
350
|
version: '0'
|
351
351
|
requirements: []
|
352
|
-
rubygems_version: 3.0.
|
352
|
+
rubygems_version: 3.0.6
|
353
353
|
signing_key:
|
354
354
|
specification_version: 4
|
355
355
|
summary: An opinionated Ruby interface to the Zuora API.
|