diff --git a/lib/recurly/plan.rb b/lib/recurly/plan.rb index 153ef5bf7..6162dad6d 100644 --- a/lib/recurly/plan.rb +++ b/lib/recurly/plan.rb @@ -1,5 +1,3 @@ -require_relative './rev_rec' - module Recurly # Recurly Documentation: https://dev.recurly.com/docs/list-plans class Plan < Resource diff --git a/lib/recurly/resource.rb b/lib/recurly/resource.rb index 8d93bbb7e..d3c11653a 100644 --- a/lib/recurly/resource.rb +++ b/lib/recurly/resource.rb @@ -1,5 +1,6 @@ require 'date' require 'erb' +require_relative './rev_rec' module Recurly # The base class for all Recurly resources (e.g. {Account}, {Subscription}, diff --git a/lib/recurly/shipping_method.rb b/lib/recurly/shipping_method.rb index 76d915c14..2f1e45c2e 100644 --- a/lib/recurly/shipping_method.rb +++ b/lib/recurly/shipping_method.rb @@ -7,7 +7,7 @@ class ShippingMethod < Resource tax_code created_at updated_at - ) + ) + RevRec::PRODUCT_ATTRIBUTES alias to_param code end end diff --git a/spec/fixtures/shipping_methods/show-200.xml b/spec/fixtures/shipping_methods/show-200.xml index faac8499b..966956cbe 100644 --- a/spec/fixtures/shipping_methods/show-200.xml +++ b/spec/fixtures/shipping_methods/show-200.xml @@ -6,6 +6,9 @@ Content-Type: application/xml; charset=utf-8 fedex_ground FedEx Ground + twywqfr48v9l + thproqnpcuwp + 4 2019-05-07T16:36:22Z 2019-05-07T16:36:22Z diff --git a/spec/recurly/shipping_method_spec.rb b/spec/recurly/shipping_method_spec.rb index 0e4094383..a805850a2 100644 --- a/spec/recurly/shipping_method_spec.rb +++ b/spec/recurly/shipping_method_spec.rb @@ -2,12 +2,21 @@ describe ShippingMethod do describe ".find" do - it "must return a shipping method when available" do + before do stub_api_request( :get, 'shipping_methods/fedex_ground', 'shipping_methods/show-200' - ) + ) + end + it "must return a shipping method when available" do shipping_method = ShippingMethod.find 'fedex_ground' shipping_method.must_be_instance_of ShippingMethod end + + it "returns RevRec values" do + shipping_method = ShippingMethod.find 'fedex_ground' + shipping_method.performance_obligation_id.must_equal('4') + shipping_method.revenue_gl_account_id.must_equal('thproqnpcuwp') + shipping_method.liability_gl_account_id.must_equal('twywqfr48v9l') + end end end \ No newline at end of file