finix 0.11 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Yjk4MjU3OGNmZDdjZmJiMmEzMTkwMDU5MjVlYmEwYzI3ZWI1YzI1OQ==
4
+ YmY5ODAxNGZiNTk3N2M0NGM2ZWIzMjk5NzdiMTg5NDhjNTI0MDE2NA==
5
5
  data.tar.gz: !binary |-
6
- MjM4NTEzZDFhNWFmYzhkZDVmZDJiOTcyNDdlM2VkNmM2Zjg4NWMzMg==
6
+ NTMyNmFlZGMwZGMwOTYzY2E3YTM1MjQ3NzI0ODc1NTRlODQxZWI4Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWQ5OTQxOGE2NjRlYmU3Mzk5YmEyZjY3YTc0YTg0ZDk3ZWQ0ODlkZDIxZDM2
10
- NzY2ZDlkNmFhZjZlZTM0OWRiYTFjOTUxOGE1OWI0N2I1MTJkNjU3ZmQxNTFl
11
- OGY1ODZmNTIwMjM4YjU4ZGY1OGFiYThhZDhmMDA4NThiNzU4Y2E=
9
+ ODg5NmZhMDc2NjJhZWI5OTBlZmIwMDY5MWM2ZmJjOWJkMWNkNzhjMzU4NWU4
10
+ YzU0Y2ExNTBkZDE3YWViYzgzMGQ1M2ZjZDMwOWVmY2M0YjcwMmM1MGZmYmNh
11
+ NjA3ZDE1YzhmYTVlZjY1ODRjNDRiNjk0MjNkMDk4MDlhMzg3YWE=
12
12
  data.tar.gz: !binary |-
13
- NzMwOTkyYTYwNTE1MTZiZTI2ZDEwYTFmNGU1OWQ2ZGU0ZmMwOTllYzAzMjA4
14
- N2UxNjkxNGU3NzYyN2RhMmJkZWViODM0NmJlZjhmODhhYjJjNzY4OWIwOGY2
15
- NThjMDk2Y2Y5YWJkZDkxYTNhNmZjZGJiZTUzNmQ5ZTg2YjJhNDI=
13
+ ZGU3MDhmMDgxODJkYjgyOGM0NjJjZTJiZDI3ZjYzNjYzZjY3MWNiYjQxZTg4
14
+ M2VkMThiYTk3ZTZlOTI5NjkzYmY4NDJjYWExZTAxODVlMjZhZTZjYjAxNTlk
15
+ NTE3M2UzNmI0ZjZlNWMyNzVkMWNhMWRiNDk2ODZmYmIzZDZmOTE=
@@ -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)
@@ -30,10 +30,6 @@ module Finix
30
30
  def to_s
31
31
  "#{self.class.name.split('::').last || ''} #{@attributes}"
32
32
  end
33
-
34
- def inspect
35
- to_s
36
- end
37
33
  end
38
34
 
39
35
  class BadRequest < ResourceErrors; end
@@ -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(link[:href], {}))
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 {}
@@ -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 }
@@ -1,3 +1,3 @@
1
1
  module Finix
2
- VERSION = '0.11'
2
+ VERSION = '0.12'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finix
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.11'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - finix-payments