Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adding support for CarrierService resource #117

Merged
merged 1 commit into from

2 participants

@benjlcox
Collaborator

Noticed this was missing, figured I'd add it in. Seems to have been an uptick in interest in setting up custom carrier services lately

@pickle27 care to give a review?

@kevinhughes27
Collaborator

:+1:

@benjlcox benjlcox merged commit cccfae5 into from
@maartenvg maartenvg deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 10, 2014
  1. @benjlcox
This page is out of date. Refresh to see the latest.
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
+ }
+}
Something went wrong with that request. Please try again.