wizypay-api-client 0.2.5 → 0.2.6

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
  SHA1:
3
- metadata.gz: 818ea735db4fbdb6ea88cde60677703f9ce018fd
4
- data.tar.gz: 3a8a28123ca944353f29e995f35b7d60e22900ef
3
+ metadata.gz: 387b0101fe922e7289f27ce14001af9bf7a28707
4
+ data.tar.gz: 936a44b3574d9eace3f30c8aae7a972acf9cd0a7
5
5
  SHA512:
6
- metadata.gz: 728d5f5887e427adf3d47f9e997a8181cbbd98ffe2f07074ce3b1b0aaf5802dd51852f24aae6305a6381e07730adb5d282a46289090086364439840c0d615285
7
- data.tar.gz: 196afcd8ca81c7e026625acbdb96fb52c9f8644ad1e91941de219391f5a24ff2c984cff5d248dab107f45dcf41f7c6be08129bd3d6a3ca76c4c0e03716330b17
6
+ metadata.gz: cb507d2013a379a0b8439e3146f510801a6c634052227f12ed4e6a57e071b3d1c8179d0555aad78e819aa2c4bbd3c729d6fa0d62f3dd7bea569680a2783a3dfd
7
+ data.tar.gz: 00d188f4fbf388535ddaa1f95a55b8460e643e9feb180164dc1e5c0a218287b7aed2071e064e3faf2f351e566cc13272ec01b9dbb6450b903a8aede5d481719f
data/lib/wizypay.rb CHANGED
@@ -2,7 +2,7 @@ require 'time'
2
2
  require 'rest-client'
3
3
  require 'simple-hmac'
4
4
  require 'json'
5
- require_relative 'wizypay/client'
5
+ require_relative 'wizypay/api_client'
6
6
  require_relative 'wizypay/resource'
7
7
  require_relative 'wizypay/collection'
8
8
  require_relative 'wizypay/card'
@@ -16,9 +16,9 @@ require_relative 'wizypay/beneficiary'
16
16
 
17
17
  module Wizypay
18
18
  def self.setup(api_key, api_secret, api_endpoint = 'https://api.wizypay.com')
19
- Wizypay::Client.api_endpoint = api_endpoint
20
- Wizypay::Client.api_key = api_key
21
- Wizypay::Client.api_secret = api_secret
19
+ Wizypay::ApiClient.api_endpoint = api_endpoint
20
+ Wizypay::ApiClient.api_key = api_key
21
+ Wizypay::ApiClient.api_secret = api_secret
22
22
  nil
23
23
  end
24
24
  end
@@ -1,7 +1,7 @@
1
1
  require 'deep_merge'
2
2
 
3
3
  module Wizypay
4
- class Client
4
+ class ApiClient
5
5
  class << self
6
6
  attr_accessor :api_endpoint, :api_key, :api_secret
7
7
 
@@ -1,7 +1,7 @@
1
1
  module Wizypay
2
2
  class Beneficiary < Resource
3
3
  def self.where(q)
4
- raw = Client.get('/beneficiaries', q)
4
+ raw = ApiClient.get('/beneficiaries', q)
5
5
  Collection.new(self, raw[:data], raw[:meta])
6
6
  end
7
7
 
@@ -10,7 +10,7 @@ module Wizypay
10
10
  end
11
11
 
12
12
  def self.find(id)
13
- new(Client.get("/beneficiaries/#{id}")[:data])
13
+ new(ApiClient.get("/beneficiaries/#{id}")[:data])
14
14
  end
15
15
 
16
16
  def cards
@@ -18,7 +18,7 @@ module Wizypay
18
18
  end
19
19
 
20
20
  def save
21
- reinitialize Client.put("/beneficiaries/#{id}", to_h)[:data]
21
+ reinitialize ApiClient.put("/beneficiaries/#{id}", to_h)[:data]
22
22
  end
23
23
  end
24
24
  end
data/lib/wizypay/card.rb CHANGED
@@ -3,7 +3,7 @@ module Wizypay
3
3
  include SimpleHmac::Helper
4
4
 
5
5
  def self.where(q)
6
- raw = Client.get('/cards', q)
6
+ raw = ApiClient.get('/cards', q)
7
7
  Collection.new(self, raw[:data], raw[:meta])
8
8
  end
9
9
 
@@ -12,7 +12,7 @@ module Wizypay
12
12
  end
13
13
 
14
14
  def self.find(id)
15
- new(Client.get("/cards/#{id}")[:data])
15
+ new(ApiClient.get("/cards/#{id}")[:data])
16
16
  end
17
17
 
18
18
  def self.create(reference, amount, currency, merchant_id, user)
@@ -35,27 +35,27 @@ module Wizypay
35
35
  end
36
36
 
37
37
  def cancel
38
- Client.post("/cards/#{URI::encode_www_form_component reference}/cancel")
38
+ ApiClient.post("/cards/#{URI::encode_www_form_component reference}/cancel")
39
39
  end
40
40
 
41
41
  def refund(amount)
42
- Client.post("/cards/#{URI::encode_www_form_component reference}/refund", amount: amount)
42
+ ApiClient.post("/cards/#{URI::encode_www_form_component reference}/refund", amount: amount)
43
43
  end
44
44
 
45
45
  def url
46
46
  timestamp = Time.now.utc.httpdate
47
- security = sign_string("#{reference}\n#{timestamp}", Client.api_secret)
47
+ security = sign_string("#{reference}\n#{timestamp}", ApiClient.api_secret)
48
48
  query_string = {
49
- key: Client.api_key,
49
+ key: ApiClient.api_key,
50
50
  timestamp: timestamp,
51
51
  reference: reference,
52
52
  security: security
53
53
  }.map { |k, v| "#{k}=#{URI::encode_www_form_component(v)}" }.join('&')
54
- "#{Client.api_endpoint}/widget?#{query_string}"
54
+ "#{ApiClient.api_endpoint}/widget?#{query_string}"
55
55
  end
56
56
 
57
57
  def save
58
- reinitialize Client.post('/cards', to_h)
58
+ reinitialize ApiClient.post('/cards', to_h)
59
59
  end
60
60
 
61
61
  def created_at
@@ -1,7 +1,7 @@
1
1
  module Wizypay
2
2
  class Merchant < Resource
3
3
  def self.where(q)
4
- raw = Client.get('/merchants', q)
4
+ raw = ApiClient.get('/merchants', q)
5
5
  Collection.new(self, raw[:data], raw[:meta])
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  module Wizypay
2
2
  class MerchantCategory < Resource
3
3
  def self.all
4
- raw = Client.get('/merchant_categories')
4
+ raw = ApiClient.get('/merchant_categories')
5
5
  Collection.new(self, raw[:data], raw[:meta])
6
6
  end
7
7
  end
@@ -5,7 +5,7 @@ module Wizypay
5
5
  end
6
6
 
7
7
  def self.for_id(merchant_id)
8
- raw = Client.get("/merchants/#{merchant_id}/versions")
8
+ raw = ApiClient.get("/merchants/#{merchant_id}/versions")
9
9
  Collection.new(self, raw[:data], raw[:meta])
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module Wizypay
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wizypay-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chaker Nakhli
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-03 00:00:00.000000000 Z
13
+ date: 2016-02-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: simple-hmac
@@ -151,9 +151,9 @@ files:
151
151
  - Rakefile
152
152
  - lib/wizypay.rb
153
153
  - lib/wizypay/ad.rb
154
+ - lib/wizypay/api_client.rb
154
155
  - lib/wizypay/beneficiary.rb
155
156
  - lib/wizypay/card.rb
156
- - lib/wizypay/client.rb
157
157
  - lib/wizypay/collection.rb
158
158
  - lib/wizypay/merchant.rb
159
159
  - lib/wizypay/merchant_category.rb