Changed from ApplePay::Domain to ApplePayDomain

This commit is contained in:
Vijay Singh 2016-09-14 18:43:56 -07:00
parent 4e802c9814
commit 7ac03e0a88
3 changed files with 34 additions and 38 deletions

View File

@ -1,14 +1,12 @@
module Stripe
module ApplePay
# Domains registered for Apple Pay on the Web
class Domain < APIResource
def self.resource_url
'/v1/apple_pay/domains'
end
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
# Domains registered for Apple Pay on the Web
class ApplePayDomain < APIResource
def self.resource_url
'/v1/apple_pay/domains'
end
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
end
end

View File

@ -54,7 +54,7 @@ module Stripe
'order' => Order,
'order_return' => OrderReturn,
'three_d_secure' => ThreeDSecure,
'apple_pay_domain' => ApplePay::Domain,
'apple_pay_domain' => ApplePayDomain,
}
end

View File

@ -1,35 +1,33 @@
require File.expand_path('../../test_helper', __FILE__)
module Stripe
module ApplePay
class DomainTest < Test::Unit::TestCase
should "create should return a new Apple Pay domain" do
@mock.expects(:post).once
.with('https://api.stripe.com/v1/apple_pay/domains', nil, '')
.returns(make_response(make_apple_pay_domain))
d = Stripe::ApplePay::Domain.create
assert_equal "apwc_test_domain", d.id
end
class ApplePayDomainTest < Test::Unit::TestCase
should "create should return a new Apple Pay domain" do
@mock.expects(:post).once
.with('https://api.stripe.com/v1/apple_pay/domains', nil, '')
.returns(make_response(make_apple_pay_domain))
d = Stripe::ApplePayDomain.create
assert_equal "apwc_test_domain", d.id
end
should "domains should be deletable" do
@mock.expects(:get).once
.with('https://api.stripe.com/v1/apple_pay/domains/apwc_test_domain', nil, nil)
.returns(make_response(make_apple_pay_domain))
@mock.expects(:delete).once.returns(make_response(make_apple_pay_domain(:deleted => true)))
domain = Stripe::ApplePay::Domain.retrieve('apwc_test_domain')
domain.delete
assert domain.deleted
end
should "domains should be deletable" do
@mock.expects(:get).once
.with('https://api.stripe.com/v1/apple_pay/domains/apwc_test_domain', nil, nil)
.returns(make_response(make_apple_pay_domain))
@mock.expects(:delete).once.returns(make_response(make_apple_pay_domain(:deleted => true)))
domain = Stripe::ApplePayDomain.retrieve('apwc_test_domain')
domain.delete
assert domain.deleted
end
should "domains should be listable" do
@mock.expects(:get).once.with('https://api.stripe.com/v1/apple_pay/domains', nil, nil)
.returns(make_response(make_apple_pay_domain_array))
domains = Stripe::ApplePay::Domain.list
assert domains.data.kind_of?(Array)
assert_equal 3, domains.data.length
domains.each do |domain|
assert domain.kind_of?(Stripe::ApplePay::Domain)
end
should "domains should be listable" do
@mock.expects(:get).once.with('https://api.stripe.com/v1/apple_pay/domains', nil, nil)
.returns(make_response(make_apple_pay_domain_array))
domains = Stripe::ApplePayDomain.list
assert domains.data.kind_of?(Array)
assert_equal 3, domains.data.length
domains.each do |domain|
assert domain.kind_of?(Stripe::ApplePayDomain)
end
end
end