From 7ac03e0a881e51caf3df607dbbfbc9c57e377fc5 Mon Sep 17 00:00:00 2001 From: Vijay Singh Date: Wed, 14 Sep 2016 18:43:56 -0700 Subject: [PATCH] Changed from ApplePay::Domain to ApplePayDomain --- lib/stripe/apple_pay_domain.rb | 18 +++++----- lib/stripe/util.rb | 2 +- test/stripe/apple_pay_domain_test.rb | 52 +++++++++++++--------------- 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/lib/stripe/apple_pay_domain.rb b/lib/stripe/apple_pay_domain.rb index f0e22fc0..98212b55 100644 --- a/lib/stripe/apple_pay_domain.rb +++ b/lib/stripe/apple_pay_domain.rb @@ -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 diff --git a/lib/stripe/util.rb b/lib/stripe/util.rb index 93f0dd72..df43e9a4 100644 --- a/lib/stripe/util.rb +++ b/lib/stripe/util.rb @@ -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 diff --git a/test/stripe/apple_pay_domain_test.rb b/test/stripe/apple_pay_domain_test.rb index 9891f12c..c5d49e68 100644 --- a/test/stripe/apple_pay_domain_test.rb +++ b/test/stripe/apple_pay_domain_test.rb @@ -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