finix 0.11 → 0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/finix.rb +6 -1
- data/lib/finix/error.rb +0 -4
- data/lib/finix/resources/payment_instrument.rb +0 -1
- data/lib/finix/resources/resource.rb +2 -6
- data/lib/finix/utils.rb +5 -0
- data/lib/finix/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmY5ODAxNGZiNTk3N2M0NGM2ZWIzMjk5NzdiMTg5NDhjNTI0MDE2NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTMyNmFlZGMwZGMwOTYzY2E3YTM1MjQ3NzI0ODc1NTRlODQxZWI4Nw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODg5NmZhMDc2NjJhZWI5OTBlZmIwMDY5MWM2ZmJjOWJkMWNkNzhjMzU4NWU4
|
10
|
+
YzU0Y2ExNTBkZDE3YWViYzgzMGQ1M2ZjZDMwOWVmY2M0YjcwMmM1MGZmYmNh
|
11
|
+
NjA3ZDE1YzhmYTVlZjY1ODRjNDRiNjk0MjNkMDk4MDlhMzg3YWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGU3MDhmMDgxODJkYjgyOGM0NjJjZTJiZDI3ZjYzNjYzZjY3MWNiYjQxZTg4
|
14
|
+
M2VkMThiYTk3ZTZlOTI5NjkzYmY4NDJjYWExZTAxODVlMjZhZTZjYjAxNTlk
|
15
|
+
NTE3M2UzNmI0ZjZlNWMyNzVkMWNhMWRiNDk2ODZmYmIzZDZmOTE=
|
data/lib/finix.rb
CHANGED
@@ -44,6 +44,11 @@ module Finix
|
|
44
44
|
def get_href(cls)
|
45
45
|
href = Finix.hypermedia_registry.key(cls)
|
46
46
|
href = Finix.hypermedia_registry.key(cls.superclass) if href.nil?
|
47
|
+
if href.nil? # support wrapper module
|
48
|
+
mod = cls.name.split('::').first
|
49
|
+
scls = cls.superclass.superclass.name.split('::').last
|
50
|
+
href = Finix.hypermedia_registry.key(self.instance_eval "#{mod}::#{scls}")
|
51
|
+
end
|
47
52
|
href
|
48
53
|
end
|
49
54
|
|
@@ -54,7 +59,7 @@ module Finix
|
|
54
59
|
cls = cls.send :hypermedia_subtype, attributes if not cls.nil? and cls.respond_to?(:hypermedia_subtype)
|
55
60
|
return cls unless cls.nil?
|
56
61
|
end
|
57
|
-
Finix::UnknownResource
|
62
|
+
Finix::Utils.eval_class self, 'UnknownResource'
|
58
63
|
end
|
59
64
|
|
60
65
|
def get(*args, &block)
|
data/lib/finix/error.rb
CHANGED
@@ -11,7 +11,6 @@ module Finix
|
|
11
11
|
unless response.nil?
|
12
12
|
type = response['instrument_type'] || response['type']
|
13
13
|
name = self.name.sub! 'PaymentInstrument', 'PaymentCard'
|
14
|
-
self.instance_eval name
|
15
14
|
if type == 'PAYMENT_CARD'
|
16
15
|
name = self.name.sub! 'PaymentInstrument', 'PaymentCard'
|
17
16
|
elsif type == 'BANK_ACCOUNT'
|
@@ -23,7 +23,7 @@ module Finix
|
|
23
23
|
if property == 'self'
|
24
24
|
@hyperlinks[:self] = link[:href]
|
25
25
|
else
|
26
|
-
@hyperlinks[property] = Finix::Utils.callable(Finix::Pagination.new
|
26
|
+
@hyperlinks[property] = Finix::Utils.callable(Finix::Utils.eval_class(self, 'Pagination').new link[:href], {})
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -90,10 +90,6 @@ module Finix
|
|
90
90
|
"#{self.class.name.split('::').last || ''} #{@attributes}"
|
91
91
|
end
|
92
92
|
|
93
|
-
def inspect
|
94
|
-
to_s
|
95
|
-
end
|
96
|
-
|
97
93
|
def self.included(base)
|
98
94
|
base.extend ClassMethods
|
99
95
|
end
|
@@ -112,7 +108,7 @@ module Finix
|
|
112
108
|
def fetch(*arguments)
|
113
109
|
if arguments.nil? or arguments.empty? or arguments[0].nil? or arguments[0].to_s.empty?
|
114
110
|
href = Finix.hypermedia_registry.key(self)
|
115
|
-
return Finix::Pagination.new href
|
111
|
+
return Finix::Utils.eval_class(self, 'Pagination').new href
|
116
112
|
end
|
117
113
|
|
118
114
|
options = arguments.slice!(0) or {}
|
data/lib/finix/utils.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
module Finix
|
2
2
|
module Utils
|
3
|
+
def eval_class(slf, name)
|
4
|
+
mod = slf.class.name.split("::").first unless slf.kind_of? Class or slf.kind_of? Module
|
5
|
+
mod = slf.name.split("::").first if mod.nil?
|
6
|
+
self.instance_eval "#{mod}::#{name}"
|
7
|
+
end
|
3
8
|
|
4
9
|
def callable(callable_or_not)
|
5
10
|
callable_or_not.respond_to?(:call) ? callable_or_not : lambda { callable_or_not }
|
data/lib/finix/version.rb
CHANGED