Browse files

Adding support for CarrierService resource

  • Loading branch information...
1 parent 32aea1b commit af64fb01b2a8eb32cc27f39ca546d976d9f3da6c @benjlcox benjlcox committed Feb 10, 2014
Showing with 34 additions and 0 deletions.
  1. +4 −0 CHANGELOG
  2. +4 −0 lib/shopify_api/resources/carrier_service.rb
  3. +17 −0 test/carrier_service_test.rb
  4. +9 −0 test/fixtures/carrier_service.json
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+== Version 3.2.1 (Unreleased)
+
+* Added CarrierService resource
+
== Version 3.2.0
* in Session::request_token params is no longer optional, you must pass all the params and the method will now extract the code
View
4 lib/shopify_api/resources/carrier_service.rb
@@ -0,0 +1,4 @@
+module ShopifyAPI
+ class CarrierService < Base
+ end
+end
View
17 test/carrier_service_test.rb
@@ -0,0 +1,17 @@
+require 'test_helper'
+
+class CarrierServiceTest < Test::Unit::TestCase
+ test 'new should create carrier service' do
+ fake "carrier_services", :method => :post, :body => load_fixture('carrier_service')
+ carrier_service = ShopifyAPI::CarrierService.new(:name => "Some Postal Service")
+ carrier_service.save
+ assert_equal "Some Postal Service" , carrier_service.name
+ end
+
+ test 'find should return the carrier service' do
+ fake "carrier_services/123456", :method => :get, :body => load_fixture('carrier_service')
+ carrier_service = ShopifyAPI::CarrierService.find(123456)
+ assert_equal 123456 , carrier_service.id
+ assert_equal "Some Postal Service", carrier_service.name
+ end
+end
View
9 test/fixtures/carrier_service.json
@@ -0,0 +1,9 @@
+{
+ "carrier_service": {
+ "name": "Some Postal Service",
+ "id": 123456,
+ "callback_url": "http://google.com",
+ "format": "json",
+ "service_discovery": true
+ }
+}

0 comments on commit af64fb0

Please sign in to comment.