Skip to content

Commit

Permalink
Merge pull request #883 from recurly/add_revrec_shipping_methods
Browse files Browse the repository at this point in the history
Add revrec shipping methods
  • Loading branch information
tilley-kyle authored Feb 14, 2024
2 parents 83fa6df + 68e9bc2 commit e76fe7f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/recurly/plan.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require_relative './rev_rec'

module Recurly
# Recurly Documentation: https://dev.recurly.com/docs/list-plans
class Plan < Resource
Expand Down
1 change: 1 addition & 0 deletions lib/recurly/resource.rb
Original file line number Diff line number Diff line change
@@ -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},
Expand Down
2 changes: 1 addition & 1 deletion lib/recurly/shipping_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ShippingMethod < Resource
tax_code
created_at
updated_at
)
) + RevRec::PRODUCT_ATTRIBUTES
alias to_param code
end
end
3 changes: 3 additions & 0 deletions spec/fixtures/shipping_methods/show-200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Content-Type: application/xml; charset=utf-8
<code>fedex_ground</code>
<name>FedEx Ground</name>
<accounting_code></accounting_code>
<liability_gl_account_id>twywqfr48v9l</liability_gl_account_id>
<revenue_gl_account_id>thproqnpcuwp</revenue_gl_account_id>
<performance_obligation_id>4</performance_obligation_id>
<tax_code></tax_code>
<created_at type="datetime">2019-05-07T16:36:22Z</created_at>
<updated_at type="datetime">2019-05-07T16:36:22Z</updated_at>
Expand Down
13 changes: 11 additions & 2 deletions spec/recurly/shipping_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e76fe7f

Please sign in to comment.