gyft 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gyft.gemspec +0 -1
- data/lib/gyft/client.rb +12 -8
- data/lib/gyft/client/reseller.rb +13 -6
- data/lib/gyft/version.rb +1 -1
- data/spec/card_spec.rb +21 -0
- data/spec/client/health_spec.rb +24 -0
- data/spec/client/partner_spec.rb +44 -0
- data/spec/client/reseller_spec.rb +60 -0
- data/spec/client/transactions_spec.rb +54 -0
- data/spec/client_spec.rb +112 -0
- data/spec/test_helper.rb +4 -0
- data/spec/transaction_spec.rb +43 -0
- metadata +9 -16
- data/spec/gyft_spec.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cacc42d597e9d65aaef5cb8fc4b4a1b1bd4d257
|
4
|
+
data.tar.gz: 7d0bfd2bb5bcedcfb091c556eb17d9da29ac0d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b05032d9ff5336b23772d406e72fb42270acca69212b69398adee074233ce401afe59cf74c9f8b4e4dffe328b9aea0e6b47e17284b289f1b597a53a5fa0c927
|
7
|
+
data.tar.gz: 6922c59dcdeb5780b396937b7b9c37d45746adb7dd575009f92d73abce0f4a63c942df2b913efb4a83e94ccda5245602239bc35dd19f9c6db606c35f9c12a822
|
data/gyft.gemspec
CHANGED
data/lib/gyft/client.rb
CHANGED
@@ -5,31 +5,31 @@ require 'json'
|
|
5
5
|
module Gyft
|
6
6
|
class Client
|
7
7
|
class ServerError < StandardError; end
|
8
|
+
class NotFoundError < StandardError; end
|
9
|
+
class BadRequestError < StandardError; end
|
8
10
|
|
9
11
|
ENDPOINTS = {
|
10
12
|
'production' => 'api.gyft.com',
|
11
13
|
'sandbox' => 'apitest.gyft.com'
|
12
14
|
}
|
13
15
|
|
14
|
-
attr_accessor :api_key, :api_secret, :environment, :http
|
16
|
+
attr_accessor :api_key, :api_secret, :environment, :http, :reseller
|
15
17
|
|
16
18
|
def initialize(options = {})
|
17
19
|
@api_key = options.fetch(:api_key) do
|
18
|
-
ENV['
|
19
|
-
ArgumentError.new("Missing required argument: api_key")
|
20
|
+
ENV['GYFT_API_KEY'] || raise(KeyError, "Missing required argument: api_key")
|
20
21
|
end
|
21
22
|
|
22
23
|
@api_secret = options.fetch(:api_secret) do
|
23
|
-
ENV['
|
24
|
-
ArgumentError.new("Missing required argument: api_secret")
|
24
|
+
ENV['GYFT_API_SECRET'] || raise(KeyError, "Missing required argument: api_secret")
|
25
25
|
end
|
26
26
|
|
27
27
|
@environment = begin
|
28
28
|
environment = options.fetch(:environment) do
|
29
|
-
ENV['
|
29
|
+
ENV['GYFT_API_ENVIRONMENT'] || 'sandbox'
|
30
30
|
end
|
31
31
|
unless %w{production sandbox}.include?(environment)
|
32
|
-
raise
|
32
|
+
raise(KeyError, "Invalid argument: environment should be one of 'production' or 'sandbox'")
|
33
33
|
end
|
34
34
|
environment
|
35
35
|
end
|
@@ -47,7 +47,7 @@ module Gyft
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def reseller
|
50
|
-
Gyft::Client::Reseller.new(self)
|
50
|
+
@reseller ||= Gyft::Client::Reseller.new(self)
|
51
51
|
end
|
52
52
|
|
53
53
|
def partner
|
@@ -94,6 +94,10 @@ module Gyft
|
|
94
94
|
case response
|
95
95
|
when Net::HTTPSuccess
|
96
96
|
json?(response) ? JSON.parse(response.body) : response.body
|
97
|
+
when Net::HTTPNotFound
|
98
|
+
raise NotFoundError, "Record not found (404)"
|
99
|
+
when Net::HTTPBadRequest
|
100
|
+
raise BadRequestError, "Bad request (400)"
|
97
101
|
else
|
98
102
|
if json?(response)
|
99
103
|
raise ServerError, "HTTP #{response.code}: #{JSON.parse(response.body)}"
|
data/lib/gyft/client/reseller.rb
CHANGED
@@ -22,14 +22,21 @@ class Gyft::Client::Reseller
|
|
22
22
|
@client.get('/reseller/merchants')['details'].map do |merchant|
|
23
23
|
merchant[:client] = @client
|
24
24
|
merchant = Gyft::Merchant.new(merchant)
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
|
26
|
+
if merchant.shop_cards
|
27
|
+
merchant.shop_cards = merchant.shop_cards.map do |card|
|
28
|
+
card[:client] = @client
|
29
|
+
Gyft::Card.new(card)
|
30
|
+
end
|
28
31
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
|
33
|
+
if merchant.categories
|
34
|
+
merchant.categories = merchant.categories.map do |category|
|
35
|
+
category[:client] = @client
|
36
|
+
Gyft::Category.new(category)
|
37
|
+
end
|
32
38
|
end
|
39
|
+
|
33
40
|
merchant
|
34
41
|
end
|
35
42
|
end
|
data/lib/gyft/version.rb
CHANGED
data/spec/card_spec.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative './test_helper'
|
2
|
+
|
3
|
+
describe 'Gyft::Card' do
|
4
|
+
|
5
|
+
describe '.purchase' do
|
6
|
+
it "should delegate to the client" do
|
7
|
+
@client = Minitest::Mock.new
|
8
|
+
@card = Gyft::Card.new id: 123, client: @client
|
9
|
+
@partner = Minitest::Mock.new
|
10
|
+
|
11
|
+
@client.expect :partner, @partner
|
12
|
+
@partner.expect :purchase, @partner
|
13
|
+
@partner.expect :gift_card_direct, {}, [{ shop_card_id: 123, to_email: 'foo@bar.com'}]
|
14
|
+
|
15
|
+
@card.purchase(to_email: 'foo@bar.com')
|
16
|
+
|
17
|
+
@client.verify
|
18
|
+
@partner.verify
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
describe 'Gyft::Client::Health' do
|
4
|
+
|
5
|
+
describe '.check' do
|
6
|
+
it "should return if succesful" do
|
7
|
+
@client = Minitest::Mock.new
|
8
|
+
@health = Gyft::Client::Health.new @client
|
9
|
+
|
10
|
+
@client.expect :get, nil, ["/health/check"]
|
11
|
+
@health.check.must_equal true
|
12
|
+
@client.verify
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should catch a SocketError" do
|
16
|
+
@client = Gyft::Client.new(api_key: "123", api_secret: "234")
|
17
|
+
@health = Gyft::Client::Health.new @client
|
18
|
+
|
19
|
+
@client.stub :get, ->(path){ raise SocketError.new } do
|
20
|
+
@health.check.must_equal false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
describe 'Gyft::Client::Partner' do
|
4
|
+
|
5
|
+
describe '.purchase.gift_card_direct' do
|
6
|
+
before do
|
7
|
+
@client = Minitest::Mock.new
|
8
|
+
@transaction = { id: '123' }
|
9
|
+
@partner = Gyft::Client::Partner.new @client
|
10
|
+
@params = { to_email: 'foo@bar.com', shop_card_id: '234' }
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should return if succesful" do
|
14
|
+
@client.expect :post, @transaction, ["/partner/purchase/gift_card_direct", @params]
|
15
|
+
result = @partner.purchase.gift_card_direct(@params)
|
16
|
+
result.id.must_equal '123'
|
17
|
+
@client.verify
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should error if params are missing" do
|
21
|
+
@params.delete(:to_email)
|
22
|
+
assert_raises KeyError do
|
23
|
+
@partner.purchase.gift_card_direct(@params)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should ignore invalid params" do
|
28
|
+
@new_params = @params.dup
|
29
|
+
@new_params[:foo] = 'bar'
|
30
|
+
|
31
|
+
@client.expect :post, @transaction, ["/partner/purchase/gift_card_direct", @params]
|
32
|
+
@partner.purchase.gift_card_direct(@new_params)
|
33
|
+
@client.verify
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should symbolize keys" do
|
37
|
+
@new_params = { 'to_email' => 'foo@bar.com', 'shop_card_id' => '234' }
|
38
|
+
|
39
|
+
@client.expect :post, @transaction, ["/partner/purchase/gift_card_direct", @params]
|
40
|
+
@partner.purchase.gift_card_direct(@new_params)
|
41
|
+
@client.verify
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
describe 'Gyft::Client::Reseller' do
|
4
|
+
before do
|
5
|
+
@client = Minitest::Mock.new
|
6
|
+
@reseller = Gyft::Client::Reseller.new @client
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '.shop_cards' do
|
10
|
+
it "should return if succesful" do
|
11
|
+
@cards = [{ id: '123' }]
|
12
|
+
@client.expect :get, @cards, ["/reseller/shop_cards"]
|
13
|
+
result = @reseller.shop_cards
|
14
|
+
result.first.id.must_equal '123'
|
15
|
+
@client.verify
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '.categories' do
|
20
|
+
it "should return if succesful" do
|
21
|
+
@categories = { 'details' => [{ id: '123' }] }
|
22
|
+
@client.expect :get, @categories, ["/reseller/categories"]
|
23
|
+
result = @reseller.categories
|
24
|
+
result.first.id.must_equal '123'
|
25
|
+
@client.verify
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '.merchants' do
|
30
|
+
it "should return if succesful" do
|
31
|
+
@merchants = { 'details' => [{ id: '123' }] }
|
32
|
+
@client.expect :get, @merchants, ["/reseller/merchants"]
|
33
|
+
result = @reseller.merchants
|
34
|
+
result.first.id.must_equal '123'
|
35
|
+
@client.verify
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '.account' do
|
40
|
+
it "should return if succesful" do
|
41
|
+
@account = { id: '123' }
|
42
|
+
@client.expect :get, @account, ["/reseller/account"]
|
43
|
+
result = @reseller.account
|
44
|
+
result.id.must_equal @account[:id]
|
45
|
+
@client.verify
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '.transaction' do
|
50
|
+
it "should return a Gyft::Client::Transactions object" do
|
51
|
+
@reseller.transaction.must_be_instance_of Gyft::Client::Transactions
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '.transactions' do
|
56
|
+
it "should return a Gyft::Client::Transactions object" do
|
57
|
+
@reseller.transactions.must_be_instance_of Gyft::Client::Transactions
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
describe 'Gyft::Client::Transactions' do
|
4
|
+
before do
|
5
|
+
@client = Minitest::Mock.new
|
6
|
+
@transaction = { id: '123' }
|
7
|
+
@transactions = Gyft::Client::Transactions.new @client
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '.find' do
|
11
|
+
it "should return if succesful" do
|
12
|
+
@client.expect :get, @transaction, ["/reseller/transaction/123"]
|
13
|
+
result = @transactions.find(123)
|
14
|
+
result.id.must_equal '123'
|
15
|
+
@client.verify
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '.all' do
|
20
|
+
it "should return if succesful" do
|
21
|
+
@client.expect :get, [@transaction], ["/reseller/transactions"]
|
22
|
+
result = @transactions.all
|
23
|
+
result.first.id.must_equal '123'
|
24
|
+
@client.verify
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.first' do
|
29
|
+
it "should return if succesful" do
|
30
|
+
@client.expect :get, [@transaction], ["/reseller/transactions/first/10"]
|
31
|
+
result = @transactions.first(10)
|
32
|
+
result.first.id.must_equal '123'
|
33
|
+
@client.verify
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '.last' do
|
38
|
+
it "should return if succesful" do
|
39
|
+
@client.expect :get, [@transaction], ["/reseller/transactions/last/10"]
|
40
|
+
result = @transactions.last(10)
|
41
|
+
result.first.id.must_equal '123'
|
42
|
+
@client.verify
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '.refund' do
|
47
|
+
it "should return if succesful" do
|
48
|
+
@client.expect :post, @transaction, ["/reseller/transaction/refund", {id: 123}]
|
49
|
+
result = @transactions.refund(123)
|
50
|
+
result.id.must_equal '123'
|
51
|
+
@client.verify
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/client_spec.rb
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
require_relative './test_helper'
|
2
|
+
|
3
|
+
describe 'Gyft::Client' do
|
4
|
+
before do
|
5
|
+
@client = Gyft::Client.new(api_key: '123', api_secret: '234')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '.initialize' do
|
9
|
+
it "should return successful with the right params" do
|
10
|
+
client = Gyft::Client.new(api_key: '123', api_secret: '234')
|
11
|
+
client.must_be_instance_of Gyft::Client
|
12
|
+
client.api_key.must_equal '123'
|
13
|
+
client.api_secret.must_equal '234'
|
14
|
+
client.environment.must_equal 'sandbox'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be able to accept another environment" do
|
18
|
+
client = Gyft::Client.new(api_key: '123', api_secret: '234', environment: 'production')
|
19
|
+
client.environment.must_equal 'production'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return successful with the ENV variables set" do
|
23
|
+
ENV['GYFT_API_KEY'] = '123'
|
24
|
+
ENV['GYFT_API_SECRET'] = '234'
|
25
|
+
ENV['GYFT_API_ENVIRONMENT'] = 'production'
|
26
|
+
|
27
|
+
client = Gyft::Client.new
|
28
|
+
client.must_be_instance_of Gyft::Client
|
29
|
+
client.api_key.must_equal '123'
|
30
|
+
client.api_secret.must_equal '234'
|
31
|
+
client.environment.must_equal 'production'
|
32
|
+
|
33
|
+
ENV.delete('GYFT_API_KEY')
|
34
|
+
ENV.delete('GYFT_API_SECRET')
|
35
|
+
ENV.delete('GYFT_API_ENVIRONMENT')
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should raise without the right params" do
|
39
|
+
assert_raises KeyError do
|
40
|
+
Gyft::Client.new
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '.cards' do
|
46
|
+
it "should delegate to Gyft::Reseller" do
|
47
|
+
@reseller = Minitest::Mock.new
|
48
|
+
@client.reseller = @reseller
|
49
|
+
@reseller.expect :shop_cards, nil
|
50
|
+
@client.cards
|
51
|
+
@reseller.verify
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '.health' do
|
56
|
+
it "should return a Gyft::Client::Health object" do
|
57
|
+
@client.health.must_be_instance_of Gyft::Client::Health
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '.reseller' do
|
62
|
+
it "should return a Gyft::Client::Reseller object" do
|
63
|
+
@client.reseller.must_be_instance_of Gyft::Client::Reseller
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '.partner' do
|
68
|
+
it "should return a Gyft::Client::Partner object" do
|
69
|
+
@client.partner.must_be_instance_of Gyft::Client::Partner
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '.get' do
|
74
|
+
it "should return the json on success" do
|
75
|
+
stub_request(:get, /apitest.gyft.com\/mashery\/v1\/reseller\/categories/).
|
76
|
+
to_return(:status => 200, :body => '{"status":0,"details":[{"id":4,"name":"Babies & Children"}]}', :headers => { 'Content-Type' => 'application/json'})
|
77
|
+
|
78
|
+
result = @client.get('/reseller/categories')
|
79
|
+
result['details'].first['id'].must_equal 4
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should raise on 404" do
|
83
|
+
stub_request(:get, /apitest.gyft.com\/mashery\/v1\/reseller\/categories/).
|
84
|
+
to_return(:status => 404)
|
85
|
+
|
86
|
+
assert_raises Gyft::Client::NotFoundError do
|
87
|
+
@client.get('/reseller/categories')
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '.post' do
|
93
|
+
it "should return the json on success" do
|
94
|
+
body = '{"id":"1234","status":0,"gf_reseller_id":"asdasd","gf_reseller_transaction_id":123,"email":"foo@bar.com","gf_order_id":123,"gf_order_detail_id":123,"gf_gyfted_card_id":123,"invalidated":false}'
|
95
|
+
stub_request(:post, /apitest.gyft.com\/mashery\/v1\/reseller\/transactions\/refund/).
|
96
|
+
to_return(:status => 200, :body => body, :headers => { 'Content-Type' => 'application/json'})
|
97
|
+
|
98
|
+
result = @client.post('/reseller/transactions/refund', id: '123')
|
99
|
+
result['id'].must_equal '1234'
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should handle a bad request" do
|
103
|
+
stub_request(:post, /apitest.gyft.com\/mashery\/v1\/reseller\/transactions\/refund/).
|
104
|
+
to_return(:status => 400)
|
105
|
+
|
106
|
+
assert_raises Gyft::Client::BadRequestError do
|
107
|
+
@client.post('/reseller/transactions/refund', id: '123')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
data/spec/test_helper.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative './test_helper'
|
2
|
+
|
3
|
+
describe 'Gyft::Transaction' do
|
4
|
+
|
5
|
+
describe '.reload' do
|
6
|
+
it "should delegate to the client" do
|
7
|
+
@client = Minitest::Mock.new
|
8
|
+
@transaction = Gyft::Transaction.new id: 123, client: @client
|
9
|
+
@reseller = Minitest::Mock.new
|
10
|
+
@transactions = Minitest::Mock.new
|
11
|
+
|
12
|
+
@client.expect :reseller, @reseller
|
13
|
+
@reseller.expect :transactions, @transactions
|
14
|
+
@transactions.expect :find, {}, [123]
|
15
|
+
|
16
|
+
@transaction.reload
|
17
|
+
|
18
|
+
@client.verify
|
19
|
+
@reseller.verify
|
20
|
+
@transactions.verify
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.refund' do
|
25
|
+
it "should delegate to the client" do
|
26
|
+
@client = Minitest::Mock.new
|
27
|
+
@transaction = Gyft::Transaction.new id: 123, client: @client
|
28
|
+
@reseller = Minitest::Mock.new
|
29
|
+
@transactions = Minitest::Mock.new
|
30
|
+
|
31
|
+
@client.expect :reseller, @reseller
|
32
|
+
@reseller.expect :transactions, @transactions
|
33
|
+
@transactions.expect :refund, {}, [123]
|
34
|
+
|
35
|
+
@transaction.refund
|
36
|
+
|
37
|
+
@client.verify
|
38
|
+
@reseller.verify
|
39
|
+
@transactions.verify
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gyft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cristiano Betta
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: awesome_print
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
description: Wrapper for the Gyft API
|
70
56
|
email: cbetta@gmail.com
|
71
57
|
executables: []
|
@@ -88,7 +74,14 @@ files:
|
|
88
74
|
- lib/gyft/refund.rb
|
89
75
|
- lib/gyft/transaction.rb
|
90
76
|
- lib/gyft/version.rb
|
91
|
-
- spec/
|
77
|
+
- spec/card_spec.rb
|
78
|
+
- spec/client/health_spec.rb
|
79
|
+
- spec/client/partner_spec.rb
|
80
|
+
- spec/client/reseller_spec.rb
|
81
|
+
- spec/client/transactions_spec.rb
|
82
|
+
- spec/client_spec.rb
|
83
|
+
- spec/test_helper.rb
|
84
|
+
- spec/transaction_spec.rb
|
92
85
|
homepage: https://github.com/cbetta/gyft
|
93
86
|
licenses:
|
94
87
|
- MIT
|
data/spec/gyft_spec.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require 'webmock/minitest'
|
3
|
-
require 'gyft'
|
4
|
-
|
5
|
-
describe 'Gyft::Reseller' do
|
6
|
-
|
7
|
-
before do
|
8
|
-
@client = Gyft::Client.new(api_key: '123', api_secret: '234')
|
9
|
-
end
|
10
|
-
|
11
|
-
describe '.health.check' do
|
12
|
-
it 'should return the result' do
|
13
|
-
stub_request(:get, /apitest.gyft.com\/mashery/)
|
14
|
-
.to_return(status: 200, body: "", headers: {})
|
15
|
-
@client.health.check.must_equal(true)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|