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 Stripe
module ApplePay # Domains registered for Apple Pay on the Web
# Domains registered for Apple Pay on the Web class ApplePayDomain < APIResource
class Domain < APIResource def self.resource_url
def self.resource_url '/v1/apple_pay/domains'
'/v1/apple_pay/domains'
end
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
end end
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
end end
end end

View File

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

View File

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