iron_bank 4.0.1 → 4.0.2

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: 067bac2c19999dd3a589b07a34e32626df11fbbd26fdad2083131928f06c1f2f
4
- data.tar.gz: 3143662227f48f7446f72a4fee567bbb3a190243b7be0c184811d37f8d28c2f9
3
+ metadata.gz: 2eb89daa7f5b7a8a07c63cd2da6dbf61d815d43186068916a27bfba75b11454b
4
+ data.tar.gz: 794b52f7e1d01cd7096f89627fde936867ecc9d66df60f29985cbb0c1d722be1
5
5
  SHA512:
6
- metadata.gz: be04e3c77d5391cf0e076cce35e5f92a281246605b9ff217d1a12046a803aec81c76ded39d40e39124b8544bd601782c4bc38f839c08188af64bae295ee56d9a
7
- data.tar.gz: 993ad81b0fcbd3d5a31e15b76602c8d13c6a3113e59d86273dccee79b6f1bc79b7c772fe3988a89599c76c28dc3f9bdb3fa0999f0675cdf5569d1b55dd65b470
6
+ metadata.gz: 528398a47469aeb59ce99ff48f24800855a9b8200277972bcd8ace8cc41b1608f3bbbe8d210209421ed1ee9c15209727fa75978e22f5abce4023aa40c42477d6
7
+ data.tar.gz: 84a42db908a7016dcfb53ad161f2a99552adba4639d7f17679785e964bf51e28322c6cb13cd87bb0e43205e19eb6011789544bb9e5218b3a5246d24f08aaa596
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iron_bank (4.0.1)
4
+ iron_bank (4.0.2)
5
5
  faraday (~> 0)
6
6
  faraday_middleware (~> 0)
7
7
  nokogiri (~> 1)
@@ -41,18 +41,18 @@ module IronBank
41
41
  def call
42
42
  remove_last_failure_fields until valid_query?
43
43
 
44
- excluded_fields
44
+ excluded_fields - single_resource_query_fields
45
45
  end
46
46
 
47
47
  private
48
48
 
49
- attr_reader :object_name, :excluded_fields, :last_failed_fields
49
+ attr_reader :object_name, :last_failed_fields
50
50
 
51
51
  def_delegators "IronBank.logger", :info
52
+ def_delegators :object, :single_resource_query_fields
52
53
 
53
54
  def initialize(object_name)
54
55
  @object_name = object_name
55
- @excluded_fields = []
56
56
  @last_failed_fields = nil
57
57
  end
58
58
 
@@ -60,6 +60,10 @@ module IronBank
60
60
  IronBank::Resources.const_get(object_name)
61
61
  end
62
62
 
63
+ def excluded_fields
64
+ @excluded_fields ||= object.excluded_fields.dup
65
+ end
66
+
63
67
  def remove_last_failure_fields
64
68
  query_fields = object.query_fields
65
69
 
@@ -67,7 +71,7 @@ module IronBank
67
71
  last_failed_fields.any? { |failed| field.casecmp?(failed) }
68
72
  end
69
73
 
70
- @excluded_fields += failed_fields
74
+ excluded_fields.push(*failed_fields)
71
75
 
72
76
  # Remove the field for the next query
73
77
  query_fields.delete_if { |field| failed_fields.include?(field) }
@@ -12,6 +12,13 @@ module IronBank
12
12
  fields.fetch(object_name, [])
13
13
  end
14
14
 
15
+ # NOTE: For some resources, fields are queryable with some restrictions,
16
+ # e.g. the `Invoice#body` can only be added to the list of fields if
17
+ # there is only one invoice in the query response.
18
+ def single_resource_query_fields
19
+ []
20
+ end
21
+
15
22
  def fields
16
23
  return [] unless schema
17
24
 
@@ -8,7 +8,11 @@ module IronBank
8
8
  class Invoice < Resource
9
9
  # See the comment for the instance method `#body`
10
10
  def self.excluded_fields
11
- super + %w[Body]
11
+ super + single_resource_query_fields
12
+ end
13
+
14
+ def self.single_resource_query_fields
15
+ %w[Body]
12
16
  end
13
17
 
14
18
  with_schema
@@ -9,7 +9,11 @@ module IronBank
9
9
  # NOTE: Zuora doesn't let us query for more than one product rate plan
10
10
  # `ActiveCurrencies` at a time
11
11
  def self.excluded_fields
12
- super + %w[ActiveCurrencies]
12
+ super + single_resource_query_fields
13
+ end
14
+
15
+ def self.single_resource_query_fields
16
+ %w[ActiveCurrencies]
13
17
  end
14
18
 
15
19
  with_schema
@@ -6,7 +6,11 @@ module IronBank
6
6
  #
7
7
  class RatePlanCharge < Resource
8
8
  def self.excluded_fields
9
- super + %w[RolloverBalance]
9
+ super + single_resource_query_fields
10
+ end
11
+
12
+ def self.single_resource_query_fields
13
+ %w[RolloverBalance]
10
14
  end
11
15
 
12
16
  with_schema
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IronBank
4
- VERSION = "4.0.1"
4
+ VERSION = "4.0.2"
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: 4.0.1
4
+ version: 4.0.2
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-09-06 00:00:00.000000000 Z
14
+ date: 2019-09-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bump