gladepay 0.1.4 → 0.1.5

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: f182537d1f4bf218db78a5dff536ad9b6e2a802e
4
- data.tar.gz: df0df3b9c8a7e9584a18e061fa7d3526e2e77dbc
3
+ metadata.gz: 1ebcc5dec54974f3aa502ec3c2eb8b75261bdf2e
4
+ data.tar.gz: 27969552954f751bfc52476f99e66e2220001fc1
5
5
  SHA512:
6
- metadata.gz: 6515231b543d9ce4c89cbc3701653062d2642e2029a800190af60e2f45e8aee0c2dfa8a941b8ffcdf3cba641d27b904b60ce0c1c5654fe31869452f8d3705919
7
- data.tar.gz: 0bc806d636c010a6d0cd0eb6d3a22a9b08dc0c61fbeff86390f062e235de07c6b0208d91211085851d05704016f78fb0408b999e6486f0ee89ee5aaa8426bb0c
6
+ metadata.gz: 3e7c6706a3c725a1c3ab9fab6b2f5284a401ef310b67b2c40263c12963ed9ef540f3c285c9b755ba0b5bef6fa6290b0150e6148123242c44dc3efe69841ed8b0
7
+ data.tar.gz: a1d95b38e8bbba91d3d2b39f54714bfc48990eaa9b5c0855af8cfe21b0bd2239cbce1ff85fa99ab0b7dc48ffed52b90d61929f854ce447c14adce182ffe93848
data/README.md CHANGED
@@ -51,17 +51,17 @@ Or install it yourself as:
51
51
  'currency' => 'NGN'
52
52
  }
53
53
 
54
- @merchant_key = "GP0000001" #Test Data
55
- @merchant_secret = "123456789"
54
+ @merchant_id = "GP0000001" #Test Data
55
+ @merchant_key = "123456789"
56
56
  live = true #for live server, default false for test server
57
57
 
58
58
  # Demp or Test Server Instance
59
- gladepay = Gladepay.new(@merchant_key, @merchant_secret) # Or
59
+ gladepay = Gladepay.new(@merchant_id, @merchant_key) # Or
60
60
 
61
- # gladepay = Gladepay.new(@merchant_key, @merchant_secret, false)
61
+ # gladepay = Gladepay.new(@merchant_id, @merchant_key, false)
62
62
 
63
63
  #LIVE SERVER Instance
64
- # gladepay = Gladepay.new(@merchant_key, @merchant_secret, true) #for live server
64
+ # gladepay = Gladepay.new(@merchant_id, @merchant_key, true) #for live server
65
65
 
66
66
  #Get Response
67
67
  response = gladepay.card_payment(
@@ -9,21 +9,21 @@ require 'json'
9
9
  class Gladepay
10
10
  include Api
11
11
 
12
- attr_reader :merchant_key, :merchant_secret, :base_url, :live
12
+ attr_reader :merchant_id, :merchant_key, :base_url, :live
13
+
14
+ def initialize(merchant_id = nil, merchant_key = nil, live = false)
15
+ @merchant_id = if merchant_id.nil?
16
+ ENV['merchant_id']
17
+ else
18
+ merchant_id
19
+ end
13
20
 
14
- def initialize(merchant_key = nil, merchant_secret = nil, live = false)
15
21
  @merchant_key = if merchant_key.nil?
16
- ENV['MERCHANT_KEY']
22
+ ENV['merchant_key']
17
23
  else
18
24
  merchant_key
19
25
  end
20
26
 
21
- @merchant_secret = if merchant_secret.nil?
22
- ENV['MERCHANT_SECRET']
23
- else
24
- merchant_secret
25
- end
26
-
27
27
  @live = live
28
28
 
29
29
  @base_url = if @live
@@ -32,17 +32,17 @@ class Gladepay
32
32
  DEMO_BASE_URL
33
33
  end
34
34
 
35
- if @merchant_key.nil?
36
- raise GladepayBadKeyError, 'No merchant key supplied and couldn\'t find any in environment variables. Make sure to set merchant key as an environment variable MERCHANT_KEY'
35
+ if @merchant_id.nil?
36
+ raise GladepayBadKeyError, 'No merchant Id supplied and couldn\'t find any in environment variables. Make sure to set merchant Id as an environment variable merchant_id'
37
37
  end
38
38
 
39
- raise GladepayBadKeyError, "Invalid merchant key #{@merchant_key}" unless @merchant_key[0..1] == 'GP'
39
+ raise GladepayBadKeyError, "Invalid merchant key #{@merchant_id}" unless @merchant_id[0..1] == 'GP'
40
40
 
41
- if @merchant_secret.nil?
42
- raise GladepayBadKeyError, 'No merchant secret supplied and couldn\'t find any in environment variables. Make sure to set the merchant secret as an environment variable MERCHANT_SECRET'
41
+ if @merchant_key.nil?
42
+ raise GladepayBadKeyError, 'No merchant key supplied and couldn\'t find any in environment variables. Make sure to set the merchant key as an environment variable merchant_key'
43
43
  end
44
44
 
45
- raise GladepayBadKeyError, "Invalid merchant secret #{@merchant_secret}" unless @merchant_secret.to_i.to_s == @merchant_secret
45
+ raise GladepayBadKeyError, "Invalid merchant key #{@merchant_key}" unless @merchant_key.to_i.to_s == @merchant_key
46
46
 
47
47
  raise GladepayBadKeyError, 'Invalid BaseUrl Must SPECIFY LIVE or DEMO server' if @base_url.nil? && !@base_url.is_a?(TrueClass)
48
48
  end
@@ -288,7 +288,7 @@ class Gladepay
288
288
  begin
289
289
  jdata = JSON.generate(data)
290
290
  base_url_with_method = current_base_url + '/' + api_method
291
- response = RestClient.put base_url_with_method, jdata, content_type: :json, accept: :json, key: @merchant_secret, mid: @merchant_key
291
+ response = RestClient.put base_url_with_method, jdata, content_type: :json, accept: :json, key: @merchant_key, mid: @merchant_id
292
292
 
293
293
  unless response.code == 200 || response.code == 201
294
294
  raise GladepayServerError.new(response), 'HTTP Code ' + response.code.to_s + ': ' + response.body.to_s
@@ -1,3 +1,3 @@
1
1
  class Gladepay
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gladepay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chinaka Light
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-11 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler