dannysmith_coolpay 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6fac9b1ff67c565358e0256ee23b3ce65b9f727e
4
- data.tar.gz: 8fe0fb195eb6cc45fb72e8489892fa6203e624e0
3
+ metadata.gz: 6c2cc7fbde21bc7945cf7f7c824452b9022d2a6a
4
+ data.tar.gz: 5a8e4b7c69e0ddf71d76b062da345e6a8926a4ca
5
5
  SHA512:
6
- metadata.gz: 283933893bb8b652f10c3be502ffd5dc12aff45b9d883dbe04e1b32300ab5ef103d2f72cebfb23dad4983a85338609acde275781583720d9f7313c7999220a56
7
- data.tar.gz: be2200b6d67d6e3e76e03b632138bd7ae6684b9ad5e84f9ff76d75a3148d892e8c36de9b5032a4ebf99f8d8fdb7722fd550f7392ab1d2839857b5ec4d70dcb68
6
+ metadata.gz: 754616045723fe681e3504a03d39031a33e1d5103ed02dc94feb2c04c1a3a400adaa9993c1e1cf87b3b6159c31d359cde9ef586e0b7350febc82d1db7efa3373
7
+ data.tar.gz: 1f91a1b05871c8dd12e420859825a19815bfd7565718fd19b2febc08ea07b27e01eca2d6d6a88563960e4be7493b0eb5835db6c66bf4087ea7cbd252d5935929
@@ -36,7 +36,7 @@ module Coolpay
36
36
  if res.code == 201
37
37
  Payment.new(
38
38
  amount: res['payment']['amount'],
39
- recipient_id: res['payment']['recipient_id'],
39
+ recipient: find_recipient_by_id(res['payment']['recipient_id']),
40
40
  id: res['payment']['id'],
41
41
  currency: res['payment']['currency'],
42
42
  status: res['payment']['status']
@@ -50,7 +50,7 @@ module Coolpay
50
50
  res['payments'].map{ |r| Payment.new(
51
51
  id: r['id'],
52
52
  amount: r['amount'],
53
- recipient_id: r['recipient_id'],
53
+ recipient: find_recipient_by_id(r['recipient_id']),
54
54
  status: r['status'],
55
55
  currency: r['currency']
56
56
  ) }
@@ -59,6 +59,10 @@ module Coolpay
59
59
 
60
60
  private
61
61
 
62
+ def find_recipient_by_id(id)
63
+ recipients.select{|r| r.id == id}[0]
64
+ end
65
+
62
66
  def url(path)
63
67
  "#{@api_endpoint_url}#{path}"
64
68
  end
@@ -1,11 +1,11 @@
1
1
  module Coolpay
2
2
  class Payment
3
- attr_reader :id, :amount, :currency, :recipient_id, :status
4
- def initialize(id:,amount:,currency:,recipient_id:,status:)
3
+ attr_reader :id, :amount, :currency, :recipient, :status
4
+ def initialize(id:,amount:,currency:,recipient:,status:)
5
5
  @id = id
6
6
  @amount = amount
7
7
  @currency = currency
8
- @recipient_id = recipient_id
8
+ @recipient = recipient
9
9
  @status = status
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module Coolpay
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dannysmith_coolpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Smith
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-10 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler