Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fulfillment_policy.get method call
- Loading branch information
Showing
6 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,3 @@ | |
/tmp/ | ||
*.gem | ||
.rspec_status | ||
*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ class EbayAPI | |
end | ||
|
||
require_relative "fulfillment_policy/delete" | ||
require_relative "fulfillment_policy/get" |
15 changes: 15 additions & 0 deletions
15
lib/ebay_api/operations/sell/account/fulfillment_policy/get.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class EbayAPI | ||
scope :sell do | ||
scope :account do | ||
scope :fulfillment_policy do | ||
# @see https://developer.ebay.com/api-docs/sell/account/resources/fulfillment_policy/methods/getFulfillmentPolicy | ||
operation :get do | ||
option :id, proc(&:to_s) | ||
|
||
path { id } | ||
http_method :get | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
HTTP/1.1 200 OK | ||
Content-Length: 724 | ||
Content-Type: application/json | ||
|
||
{"name":"Domestic free shipping","marketplaceId":"EBAY_US","categoryTypes":[{"name":"ALL_EXCLUDING_MOTORS_VEHICLES","default":false}],"handlingTime":{"value":1,"unit":"DAY"},"shippingOptions":[{"optionType":"DOMESTIC","costType":"FLAT_RATE","shippingServices":[{"sortOrder":1,"shippingCarrierCode":"USPS","shippingServiceCode":"USPSPriorityFlatRateBox","shippingCost":{"value":0.0,"currency":"USD"},"additionalShippingCost":{"value":0.0,"currency":"USD"},"freeShipping":true,"buyerResponsibleForShipping":false,"buyerResponsibleForPickup":false}],"insuranceOffered":false,"insuranceFee":{"value":0.0,"currency":"USD"}}],"globalShipping":false,"pickupDropOff":false,"freightShipping":false,"fulfillmentPolicyId":"5733588000"} | ||
|
33 changes: 33 additions & 0 deletions
33
spec/fixtures/sell/account/fulfillment_policy/get/success.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
name: "Domestic free shipping" | ||
marketplaceId: "EBAY_US" | ||
categoryTypes: | ||
- name: "ALL_EXCLUDING_MOTORS_VEHICLES" | ||
default: false | ||
handlingTime: | ||
value: 1 | ||
unit: "DAY" | ||
shippingOptions: | ||
- optionType: "DOMESTIC" | ||
costType: "FLAT_RATE" | ||
shippingServices: | ||
- sortOrder: 1 | ||
shippingCarrierCode: "USPS" | ||
shippingServiceCode: "USPSPriorityFlatRateBox" | ||
shippingCost: | ||
value: 0.0 | ||
currency: "USD" | ||
additionalShippingCost: | ||
value: 0.0 | ||
currency: "USD" | ||
freeShipping: true | ||
buyerResponsibleForShipping: false | ||
buyerResponsibleForPickup: false | ||
insuranceOffered: false | ||
insuranceFee: | ||
value: 0.0 | ||
currency: "USD" | ||
globalShipping: false | ||
pickupDropOff: false | ||
freightShipping: false | ||
fulfillmentPolicyId: "5733588000" |
31 changes: 31 additions & 0 deletions
31
spec/operations/sell/account/fulfillment_policy/get_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
RSpec.describe EbayAPI, ".sell.account.fulfillment_policy.get" do | ||
let(:client) { described_class.new(settings) } | ||
let(:scope) { client.sell.account(version: version).fulfillment_policy } | ||
let(:settings) { yaml_fixture_file("settings.valid.yml") } | ||
let(:version) { "1.2.0" } | ||
let(:url) do | ||
"https://api.ebay.com/sell/account/v1/fulfillment_policy/5733588000" | ||
end | ||
|
||
before { stub_request(:get, url).to_return(response) } | ||
subject { scope.get id: "5733588000" } | ||
|
||
context "success" do | ||
let(:response) do | ||
open_fixture_file "sell/account/fulfillment_policy/get/success" | ||
end | ||
|
||
let(:policy) do | ||
yaml_fixture_file "sell/account/fulfillment_policy/get/success.yml" | ||
end | ||
|
||
it "sends a request" do | ||
subject | ||
expect(a_request(:get, url)).to have_been_made | ||
end | ||
|
||
it "returns the policy" do | ||
expect(subject).to eq policy | ||
end | ||
end | ||
end |