Browse Source

Merge pull request #97 from Shopify/adding_fulfillmentservice

Add support for Fulfillment Service endpoint
Ben Cox 11 years ago
parent
commit
5a7cd46ea8

+ 2 - 1
CHANGELOG

@@ -1,6 +1,7 @@
-== Version 3.1.9
+== Version 3.1.9 (Unreleased)
 
 * in Session::request_token params is no longer optional, you must pass all the params and the method will now extract the code
+* Add access to FulfillmentService endpoint
 
 == Version 3.1.8
 

+ 4 - 0
lib/shopify_api/resources/fulfillment_service.rb

@@ -0,0 +1,4 @@
+module ShopifyAPI
+  class FulfillmentService < Base
+  end
+end

+ 10 - 0
test/fixtures/fulfillment_service.json

@@ -0,0 +1,10 @@
+{
+	"fulfillment_service": {
+		"name": "SomeService",
+		"id": 123456,
+		"inventory_management": false,
+		"tracking_support": true,
+		"requires_shipping_method": false,
+		"format": "json"
+	}
+}

+ 17 - 0
test/fulfillment_service_test.rb

@@ -0,0 +1,17 @@
+require 'test_helper'
+
+class FulFillmentServiceTest < Test::Unit::TestCase
+	test 'new should create fulfillment service' do
+		fake "fulfillment_services", :method => :post, :body => load_fixture('fulfillment_service')
+		fulfillment_service = ShopifyAPI::FulfillmentService.new(:name => "SomeService")
+		fulfillment_service.save
+		assert_equal "SomeService" , fulfillment_service.name
+	end
+
+	test 'find should return the fulfillment service' do
+		fake "fulfillment_services/123456", :method => :get, :body => load_fixture('fulfillment_service')
+		fulfillment_service = ShopifyAPI::FulfillmentService.find(123456)
+		assert_equal 123456 , fulfillment_service.id
+		assert_equal "SomeService", fulfillment_service.name
+	end
+end