ship_station 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c000ebfd5f6604336805892caa3c352ff991fbc
4
- data.tar.gz: 6864e83c629ff2a0f09ebd670912ea5b0aed249a
3
+ metadata.gz: 18c0f3699a6970e2b4d037b9799f84b06e7e22d4
4
+ data.tar.gz: cc0bef5f68d5bd31a215eecae675c048c2f7cc75
5
5
  SHA512:
6
- metadata.gz: 0baf0fcaa50f07964d04b239a8a7c48e48eecced627c4cf0e98eefa95543cf6fe7127c9405265ee1d948af8ee7433abf1f5ed34de171c51dbd7111b8e66817c6
7
- data.tar.gz: da0302c83684aed39668821d2ccf4301d91d02d25eee831f096c13ed709e2d7b76f3e471402d2481a44c7e51cc25d39c1b8954f192eb124186aa34543b001bf3
6
+ metadata.gz: 9e7205bcfa8e904e2288b855c83f15aade3eeb5d2a023577d74e90858eea41e09fc8818fd330e855b497d7ebd9604033a27fb20d832751e8f0ef8b8484f3441a
7
+ data.tar.gz: 818dc358fb109575178192fc2ecfab66de71108013cb5b3b6465e37bd38115ed43fd8731e43eb64b0784f1f1e1bc896f88b52a4cf68c6e1b23c2ec1fcff6d1c7
@@ -1,4 +1,5 @@
1
1
  module ShipStation
2
2
  class Customer < Model
3
+ shipstation_has_many :orders, foreign_key: :customerId
3
4
  end
4
5
  end
@@ -0,0 +1,3 @@
1
+ module ShipStation
2
+ class Fulfillment < Model; end
3
+ end
@@ -4,5 +4,35 @@ module ShipStation
4
4
  include Her::Model
5
5
  use_api V1::API
6
6
  parse_root_in_json true, format: :active_model_serializers
7
+
8
+ def self.associated
9
+ @associated ||= {}
10
+ end
11
+
12
+ def self.shipstation_has_many(name, opts={})
13
+ self.associated[name] = opts.merge(:relationship => :has_many)
14
+ end
15
+
16
+ def self.shipstation_belongs_to(name, opts={})
17
+ self.associated[name] = opts.merge(:relationship => :belongs_to)
18
+ end
19
+
20
+ def method_missing(name, *args, &block)
21
+ association = self.class.associated.fetch(name)
22
+ if association
23
+ case association[:relationship]
24
+ when :has_many
25
+ foreign_key = association[:foreign_key]
26
+ resource = name.to_s.singularize.capitalize.classify
27
+ "ShipStation::#{resource}".constantize.where(foreign_key => self.send(foreign_key)).fetch
28
+ when :belongs_to
29
+ primary_key = association[:primary_key]
30
+ resource = name.to_s.singularize.capitalize.classify
31
+ "ShipStation::#{resource}".constantize.find(self.send(primary_key))
32
+ else
33
+ super
34
+ end
35
+ end
36
+ end
7
37
  end
8
38
  end
@@ -1,4 +1,6 @@
1
1
  module ShipStation
2
2
  class Order < Model
3
+ shipstation_has_many :shipments, foreign_key: :orderNumber
4
+ shipstation_belongs_to :customer, primary_key: :customerId
3
5
  end
4
6
  end
@@ -1,4 +1,5 @@
1
1
  module ShipStation
2
2
  class Shipment < Model
3
+ shipstation_belongs_to :order, primary_key: :orderId
3
4
  end
4
5
  end
@@ -1,3 +1,4 @@
1
1
  module ShipStation
2
- class Store < Model; end
2
+ class Store < Model
3
+ end
3
4
  end
@@ -6,11 +6,9 @@ module ShipStation
6
6
  c.use Faraday::Request::BasicAuthentication, ShipStation.username, ShipStation.password
7
7
 
8
8
  # Request
9
- # c.use Faraday::Request::UrlEncoded
10
9
  c.use ShipStation::Middleware::JSONRequest
11
10
 
12
11
  # Response
13
- # c.use Her::Middleware::DefaultParseJSON
14
12
  c.use ShipStation::Middleware::ResponseParser
15
13
 
16
14
  # Adapter
@@ -12,7 +12,7 @@ module ShipStation
12
12
 
13
13
  attr_accessor :limit
14
14
  attr_accessor :remaining
15
- attr_accessor :reset
15
+ attr_accessor :reset_time
16
16
 
17
17
  def username
18
18
  @username ||= ENV["SHIPSTATION_API_KEY"] or
@@ -1,14 +1,27 @@
1
1
  module ShipStation
2
2
  module Middleware
3
3
  class ResponseParser < Her::Middleware::FirstLevelParseJSON
4
-
4
+ def parse(env)
5
+ json = parse_json(env)
6
+
7
+ return super unless json.is_a?(Hash)
8
+
9
+ errors = json.delete(:errors) || {}
10
+ pagination = json.slice(:page, :pages, :total)
11
+ {
12
+ :data => json.except(:page, :pages, :total),
13
+ :errors => errors,
14
+ :metadata => pagination
15
+ }
16
+ end
17
+
18
+ # This middleware gives the user access to rate limiting information
5
19
  def on_complete(env)
6
- ShipStation.limit = env.response.headers["x-rate-limit-limit"]
7
- ShipStation.remaining = env.response.headers["x-rate-limit-remaining"]
8
- ShipStation.reset = env.response.headers["x-rate-limit-reset"]
20
+ ShipStation.limit = env.response.headers["x-rate-limit-limit"]
21
+ ShipStation.remaining = env.response.headers["x-rate-limit-remaining"]
22
+ ShipStation.reset_time = env.response.headers["x-rate-limit-reset"]
9
23
  super(env)
10
24
  end
11
-
12
25
  end
13
26
 
14
27
  # This middleware adds a "Content-Type: application/json" HTTP header
@@ -20,9 +33,9 @@ module ShipStation
20
33
 
21
34
  # @private
22
35
  def call(env)
23
- puts "########Request Url############"
24
- puts env.url
25
- puts "###############################"
36
+ # puts "########Request Url############"
37
+ # puts env.url
38
+ # puts "###############################"
26
39
  unless env.method == :get
27
40
  env[:body] = encode env[:body] unless env[:body].respond_to?(:to_str)
28
41
  end
@@ -1,3 +1,3 @@
1
1
  module ShipStation
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/ship_station.rb CHANGED
@@ -9,14 +9,14 @@ require 'her'
9
9
  require 'ship_station/base'
10
10
  require 'ship_station/middleware'
11
11
  require 'ship_station/api'
12
- # Models
13
12
 
13
+ # Models
14
14
  require 'ship_station/api/model'
15
15
  require 'ship_station/api/carrier'
16
16
  require 'ship_station/api/customer'
17
+ require 'ship_station/api/fulfillment'
17
18
  require 'ship_station/api/order'
18
19
  require 'ship_station/api/product'
19
20
  require 'ship_station/api/shipment'
20
21
  require 'ship_station/api/store'
21
- require 'ship_station/api/tag'
22
22
  require 'ship_station/api/warehouse'
@@ -0,0 +1,39 @@
1
+ RSpec.describe ShipStation do
2
+ it "raises configurations error if missing API key" do
3
+ ENV["SHIPSTATION_API_KEY"] = nil
4
+ ShipStation.username = nil
5
+ expect{ ShipStation.username }.to raise_error(ShipStation::ConfigurationError)
6
+ end
7
+
8
+ it "raises configurations error if missing API secret" do
9
+ ENV["SHIPSTATION_API_SECRET"] = nil
10
+ ShipStation.password = nil
11
+ expect{ ShipStation.password }.to raise_error(ShipStation::ConfigurationError)
12
+ end
13
+
14
+ it "stores rate limiting information after each request" do
15
+ stub_api_for(ShipStation::Order) do |stub|
16
+ stub.get("/orders") do |env|
17
+ [
18
+ 200,
19
+ {
20
+ "x-rate-limit-limit" => 40,
21
+ "x-rate-limit-remaining" => 39,
22
+ "x-rate-limit-reset"=>20
23
+ },
24
+ { orders: [{}],
25
+ page: 1,
26
+ pages: 1,
27
+ total: 1
28
+ }.to_json
29
+ ]
30
+ end
31
+ end
32
+
33
+ ShipStation::Order.all.fetch
34
+
35
+ expect(ShipStation.limit).to eq(40)
36
+ expect(ShipStation.remaining).to eq(39)
37
+ expect(ShipStation.reset_time).to eq(20)
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ RSpec.describe ShipStation do
2
+ it "has a version number" do
3
+ expect(ShipStation::VERSION).not_to be nil
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ RSpec.describe ShipStation::Carrier do
2
+ before do
3
+ stub_api_for(ShipStation::Carrier) do |stub|
4
+ stub.get("/carriers") do |env|
5
+ [
6
+ 200,
7
+ {},
8
+ { carriers: [{
9
+ "name": "Stamps.com",
10
+ "code": "stamps_com",
11
+ "accountNumber": "SS123",
12
+ "requiresFundedAccount": true,
13
+ "balance": 24.27,
14
+ "nickname": nil,
15
+ "shippingProviderId": 12345,
16
+ "primary": true
17
+ }],
18
+ page: 1,
19
+ pages: 1,
20
+ total: 1
21
+ }.to_json
22
+ ]
23
+ end
24
+ end
25
+ end
26
+
27
+ it "GET list" do
28
+ carriers = ShipStation::Carrier.all.fetch
29
+ expect(carriers.length).to eq(1)
30
+ expect(carriers.metadata[:page]).to eq(1)
31
+ end
32
+
33
+ it "GET search" do
34
+ code = "stamps_com"
35
+ carriers = ShipStation::Carrier.where(code: code)
36
+ carrier = carriers.first
37
+ expect(carriers.count).to eq(1)
38
+ expect(carrier.code).to eq(code)
39
+ end
40
+ end
@@ -0,0 +1,56 @@
1
+ RSpec.describe ShipStation::Customer do
2
+ before do
3
+ stub_api_for(ShipStation::Customer) do |stub|
4
+ stub.get("/customers") do |env|
5
+ [
6
+ 200,
7
+ {},
8
+ { customers: [{
9
+ "customerId": 12345678,
10
+ "createDate": "2014-11-18T10:33:01.1900000",
11
+ "modifyDate": "2014-11-18T10:33:01.1900000",
12
+ "name": "Cam Newton",
13
+ "company": "Test Company",
14
+ }],
15
+ page: 1,
16
+ pages: 1,
17
+ total: 1
18
+ }.to_json
19
+ ]
20
+ end
21
+
22
+ stub.get("/customers/12345678") do |env|
23
+ [
24
+ 200,
25
+ {},
26
+ {
27
+ "customerId": 12345678,
28
+ "createDate": "2014-11-18T10:33:01.1900000",
29
+ "modifyDate": "2014-11-18T10:33:01.1900000",
30
+ "name": "Cam Newton",
31
+ "company": "Test Company",
32
+ }.to_json
33
+ ]
34
+ end
35
+ end
36
+ end
37
+
38
+ it "GET list" do
39
+ customers = ShipStation::Customer.all.fetch
40
+ expect(customers.length).to eq(1)
41
+ expect(customers.metadata[:page]).to eq(1)
42
+ end
43
+
44
+ it "GET specific" do
45
+ customer = ShipStation::Customer.find('12345678')
46
+ expect(customer.company).to eq('Test Company')
47
+ end
48
+
49
+ it "GET search" do
50
+ name = "Cam Newton"
51
+ customers = ShipStation::Customer.where(name: name)
52
+ customer = customers.first
53
+ expect(customers.count).to eq(1)
54
+ expect(customer.name).to eq(name)
55
+ end
56
+ end
@@ -0,0 +1,46 @@
1
+ RSpec.describe ShipStation::Fulfillment do
2
+ before do
3
+ stub_api_for(ShipStation::Fulfillment) do |stub|
4
+ stub.get("/fulfillments") do |env|
5
+ [
6
+ 200,
7
+ {},
8
+ { fulfillments: [
9
+ {
10
+ "fulfillmentId": 33974374,
11
+ "orderId": 191759016,
12
+ "orderNumber": "101",
13
+ "userId": "c9f06d74-95de-4263-9b04-e87095cababf",
14
+ "customerEmail": "apisupport@shipstation.com",
15
+ "trackingNumber": "783408231234",
16
+ "createDate": "2016-06-07T08:50:50.0670000",
17
+ "shipDate": "2016-06-07T00:00:00.0000000",
18
+ },
19
+ {
20
+ "fulfillmentId": 246310,
21
+ "orderId": 193699927,
22
+ "orderNumber": "102",
23
+ "userId": "c9f06d74-95de-4263-9b04-e87095cababf",
24
+ "customerEmail": "apisupport@shipstation.com",
25
+ "trackingNumber": "664756278745",
26
+ "createDate": "2016-06-08T12:54:53.3470000",
27
+ "shipDate": "2016-06-08T00:00:00.0000000",
28
+ }
29
+ ],
30
+ page: 1,
31
+ pages: 1,
32
+ total: 2
33
+ }.to_json
34
+ ]
35
+ end
36
+ end
37
+ end
38
+
39
+ it "GET list" do
40
+ fulfillments = ShipStation::Fulfillment.all.fetch
41
+ expect(fulfillments.length).to eq(2)
42
+ expect(fulfillments.metadata[:total]).to eq(2)
43
+ expect(fulfillments.first.orderNumber).to eq("101")
44
+ expect(fulfillments.last.orderNumber).to eq("102")
45
+ end
46
+ end
@@ -0,0 +1,58 @@
1
+ RSpec.describe ShipStation::Order do
2
+ before do
3
+ stub_api_for(ShipStation::Order) do |stub|
4
+ stub.get("/orders") do |env|
5
+ [
6
+ 200,
7
+ {},
8
+ { orders: [{
9
+ "orderId"=>9222306,
10
+ "orderNumber"=>"1918",
11
+ "orderKey"=>"3991397126",
12
+ "orderDate"=>"2016-08-08T16:48:30.0000000",
13
+ "createDate"=>"2016-11-02T08:01:53.1400000",
14
+ "modifyDate"=>"2016-11-02T08:01:46.3970000"
15
+ }],
16
+ page: 1,
17
+ pages: 1,
18
+ total: 1
19
+ }.to_json
20
+ ]
21
+ end
22
+
23
+ stub.get("/orders/9222306") do |env|
24
+ [
25
+ 200,
26
+ {},
27
+ {
28
+ "orderId"=>9222306,
29
+ "orderNumber"=>"1918",
30
+ "orderKey"=>"3991397126",
31
+ "orderDate"=>"2016-08-08T16:48:30.0000000",
32
+ "createDate"=>"2016-11-02T08:01:53.1400000",
33
+ "modifyDate"=>"2016-11-02T08:01:46.3970000"
34
+ }.to_json
35
+ ]
36
+ end
37
+ end
38
+ end
39
+
40
+ it "GET list" do
41
+ orders = ShipStation::Order.all.fetch
42
+ expect(orders.length).to eq(1)
43
+ expect(orders.metadata[:page]).to eq(1)
44
+ end
45
+
46
+ it "GET specific" do
47
+ order = ShipStation::Order.find('9222306')
48
+ expect(order.orderNumber).to eq('1918')
49
+ end
50
+
51
+ it "GET search" do
52
+ orderNumber = "1918"
53
+ orders = ShipStation::Order.where(orderNumber: orderNumber)
54
+ order = orders.first
55
+ expect(orders.count).to eq(1)
56
+ expect(order.orderNumber).to eq(orderNumber)
57
+ end
58
+ end
@@ -0,0 +1,64 @@
1
+ RSpec.describe ShipStation::Product do
2
+ before do
3
+ stub_api_for(ShipStation::Product) do |stub|
4
+ stub.get("/products") do |env|
5
+ [
6
+ 200,
7
+ {},
8
+ { products: [
9
+ {
10
+ "aliases": nil,
11
+ "productId": 7854008,
12
+ "sku": "1005",
13
+ "name": "Coffee Mug",
14
+ "warehouseLocation": "Bin 22"
15
+ },
16
+ {
17
+ "aliases": nil,
18
+ "productId": 7854009,
19
+ "sku": "1005",
20
+ "name": "Coffee Filter",
21
+ "warehouseLocation": "Bin 22"
22
+ }
23
+ ],
24
+ page: 1,
25
+ pages: 1,
26
+ total: 2
27
+ }.to_json
28
+ ]
29
+ end
30
+
31
+ stub.get("/products/7854008") do |env|
32
+ [
33
+ 200,
34
+ {},
35
+ {
36
+ "aliases": nil,
37
+ "productId": 7854008,
38
+ "sku": "1005",
39
+ "name": "Coffee Mug"
40
+ }.to_json
41
+ ]
42
+ end
43
+ end
44
+ end
45
+
46
+ it "GET list" do
47
+ products = ShipStation::Product.all.fetch
48
+ expect(products.length).to eq(2)
49
+ expect(products.metadata[:total]).to eq(2)
50
+ end
51
+
52
+ it "GET specific" do
53
+ product = ShipStation::Product.find('7854008')
54
+ expect(product.sku).to eq('1005')
55
+ end
56
+
57
+ it "GET search" do
58
+ warehouseLocation = "Bin 22"
59
+ products = ShipStation::Product.where(warehouseLocation: warehouseLocation)
60
+ product = products.first
61
+ expect(products.count).to eq(2)
62
+ expect(product.warehouseLocation).to eq(warehouseLocation)
63
+ end
64
+ end
@@ -0,0 +1,65 @@
1
+ RSpec.describe ShipStation::Shipment do
2
+ before do
3
+ stub_api_for(ShipStation::Shipment) do |stub|
4
+ stub.get("/shipments") do |env|
5
+ [
6
+ 200,
7
+ {},
8
+ { shipments: [{
9
+ shipmentId: 33974374,
10
+ orderId: 43945660,
11
+ orderKey: "8061c220f0794a9b92460b8bae6837e4",
12
+ userId: "123456AB-ab12-3c4d-5e67-89f1abc1defa",
13
+ orderNumber: "100038-1",
14
+ createDate: "2014-10-03T06:51:33.6270000",
15
+ shipDate: "2014-10-03",
16
+ shipmentCost: 1.93,
17
+ insuranceCost: 0,
18
+ trackingNumber: "9400111899561704681189"}],
19
+ page: 1,
20
+ pages: 1,
21
+ total: 1
22
+ }.to_json
23
+ ]
24
+ end
25
+
26
+ stub.get("/shipments/33974374") do |env|
27
+ [
28
+ 200,
29
+ {},
30
+ {
31
+ shipmentId: 33974374,
32
+ orderId: 43945660,
33
+ orderKey: "8061c220f0794a9b92460b8bae6837e4",
34
+ userId: "123456AB-ab12-3c4d-5e67-89f1abc1defa",
35
+ orderNumber: "100038-1",
36
+ createDate: "2014-10-03T06:51:33.6270000",
37
+ shipDate: "2014-10-03",
38
+ shipmentCost: 1.93,
39
+ insuranceCost: 0,
40
+ trackingNumber: "9400111899561704681189"
41
+ }.to_json
42
+ ]
43
+ end
44
+ end
45
+ end
46
+
47
+ it "GET list" do
48
+ shipments = ShipStation::Shipment.all.fetch
49
+ expect(shipments.length).to eq(1)
50
+ expect(shipments.metadata[:page]).to eq(1)
51
+ end
52
+
53
+ it "GET specific" do
54
+ shipment = ShipStation::Shipment.find('33974374')
55
+ expect(shipment.orderNumber).to eq('100038-1')
56
+ end
57
+
58
+ it "GET search" do
59
+ orderNumber = "100038-1"
60
+ shipments = ShipStation::Shipment.where(orderNumber: orderNumber)
61
+ shipment = shipments.first
62
+ expect(shipments.count).to eq(1)
63
+ expect(shipment.orderNumber).to eq(orderNumber)
64
+ end
65
+ end
@@ -0,0 +1,68 @@
1
+ RSpec.describe ShipStation::Store do
2
+ before do
3
+ stub_api_for(ShipStation::Store) do |stub|
4
+ stub.get("/stores") do |env|
5
+ [
6
+ 200,
7
+ {},
8
+ { stores: [
9
+ {
10
+ "storeId": 22766,
11
+ "storeName": "ShipStation Manual Store",
12
+ "marketplaceId": 0,
13
+ "marketplaceName": "ShipStation",
14
+ "createDate": "2014-07-25T11:05:55.307",
15
+ "modifyDate": "2014-11-12T08:45:20.55",
16
+ },
17
+ {
18
+ "storeId": 25748,
19
+ "storeName": "Ashley's Test WooCommerce",
20
+ "marketplaceId": 36,
21
+ "marketplaceName": "WooCommerce",
22
+ "createDate": "2014-11-10T08:53:48.077",
23
+ "modifyDate": "2014-12-03T14:53:50.557",
24
+ }
25
+ ],
26
+ page: 1,
27
+ pages: 1,
28
+ total: 2
29
+ }.to_json
30
+ ]
31
+ end
32
+
33
+ stub.get("/stores/22766") do |env|
34
+ [
35
+ 200,
36
+ {},
37
+ {
38
+ "storeId": 22766,
39
+ "storeName": "ShipStation Manual Store",
40
+ "marketplaceId": 0,
41
+ "marketplaceName": "ShipStation",
42
+ "createDate": "2014-07-25T11:05:55.307",
43
+ "modifyDate": "2014-11-12T08:45:20.55",
44
+ }.to_json
45
+ ]
46
+ end
47
+ end
48
+ end
49
+
50
+ it "GET list" do
51
+ stores = ShipStation::Store.all.fetch
52
+ expect(stores.length).to eq(2)
53
+ expect(stores.metadata[:page]).to eq(1)
54
+ end
55
+
56
+ it "GET specific" do
57
+ store = ShipStation::Store.find('22766')
58
+ expect(store.storeName).to eq('ShipStation Manual Store')
59
+ end
60
+
61
+ it "GET search" do
62
+ marketplaceId = 0
63
+ stores = ShipStation::Store.where(marketplaceId: marketplaceId)
64
+ store = stores.first
65
+ expect(stores.count).to eq(2)
66
+ expect(store.marketplaceId).to eq(marketplaceId)
67
+ end
68
+ end
@@ -0,0 +1,48 @@
1
+ RSpec.describe ShipStation::Warehouse do
2
+ before do
3
+ stub_api_for(ShipStation::Warehouse) do |stub|
4
+ stub.get("/warehouses") do |env|
5
+ [
6
+ 200,
7
+ {},
8
+ [{
9
+ "warehouseId": 17977,
10
+ "warehouseName": "Main warehouse",
11
+ "createDate": "2014-10-21T08:11:43.8800000",
12
+ "isDefault": true
13
+ },
14
+ {
15
+ "warehouseId": 14265,
16
+ "warehouseName": "Austin",
17
+ "createDate": "2014-05-27T09:54:29.9600000",
18
+ "isDefault": false
19
+ }].to_json
20
+ ]
21
+ end
22
+
23
+ stub.get("/warehouses/17977") do |env|
24
+ [
25
+ 200,
26
+ {},
27
+ {
28
+ "warehouseId": 17977,
29
+ "warehouseName": "Main warehouse",
30
+ "createDate": "2014-10-21T08:11:43.8800000",
31
+ "isDefault": true
32
+ }.to_json
33
+ ]
34
+ end
35
+ end
36
+ end
37
+
38
+ it "GET list" do
39
+ warehouses = ShipStation::Warehouse.all.fetch
40
+ expect(warehouses.length).to eq(2)
41
+ expect(warehouses.metadata).to be_empty
42
+ end
43
+
44
+ it "GET specific" do
45
+ store = ShipStation::Warehouse.find('17977')
46
+ expect(store.warehouseName).to eq('Main warehouse')
47
+ end
48
+ end
@@ -0,0 +1,32 @@
1
+ require 'bundler/setup'
2
+ require 'pry'
3
+ require 'ship_station'
4
+
5
+
6
+ RSpec.configure do |config|
7
+ # Enable flags like --only-failures and --next-failure
8
+ config.example_status_persistence_file_path = ".rspec_status"
9
+
10
+ # Disable RSpec exposing methods globally on `Module` and `main`
11
+ config.disable_monkey_patching!
12
+
13
+ config.expect_with :rspec do |c|
14
+ c.syntax = :expect
15
+ end
16
+
17
+ config.include(Module.new do
18
+ def stub_api_for(klass)
19
+ klass.use_api (api = Her::API.new)
20
+
21
+ # Here, you would customize this for your own API (URL, middleware, etc)
22
+ # like you have done in your application’s initializer
23
+ api.setup url: "http://api.example.com" do |c|
24
+ c.use ShipStation::Middleware::JSONRequest
25
+ c.use ShipStation::Middleware::ResponseParser
26
+ c.adapter(:test) { |s| yield(s) }
27
+ end
28
+ end
29
+ end)
30
+
31
+
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ship_station
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Jacobs
@@ -121,16 +121,27 @@ files:
121
121
  - lib/ship_station/api.rb
122
122
  - lib/ship_station/api/carrier.rb
123
123
  - lib/ship_station/api/customer.rb
124
+ - lib/ship_station/api/fulfillment.rb
124
125
  - lib/ship_station/api/model.rb
125
126
  - lib/ship_station/api/order.rb
126
127
  - lib/ship_station/api/product.rb
127
128
  - lib/ship_station/api/shipment.rb
128
129
  - lib/ship_station/api/store.rb
129
- - lib/ship_station/api/tag.rb
130
130
  - lib/ship_station/api/warehouse.rb
131
131
  - lib/ship_station/base.rb
132
132
  - lib/ship_station/middleware.rb
133
133
  - lib/ship_station/version.rb
134
+ - spec/ship_station/base_spec.rb
135
+ - spec/ship_station/gem_spec.rb
136
+ - spec/ship_station/models/carrier_spec.rb
137
+ - spec/ship_station/models/customer_spec.rb
138
+ - spec/ship_station/models/fulfillment_spec.rb
139
+ - spec/ship_station/models/order_spec.rb
140
+ - spec/ship_station/models/product_spec.rb
141
+ - spec/ship_station/models/shipment_spec.rb
142
+ - spec/ship_station/models/store_spec.rb
143
+ - spec/ship_station/models/warehouse_spec.rb
144
+ - spec/spec_helper.rb
134
145
  homepage:
135
146
  licenses: []
136
147
  metadata:
@@ -155,4 +166,15 @@ rubygems_version: 2.6.14.1
155
166
  signing_key:
156
167
  specification_version: 4
157
168
  summary: Shipstation API
158
- test_files: []
169
+ test_files:
170
+ - spec/spec_helper.rb
171
+ - spec/ship_station/models/shipment_spec.rb
172
+ - spec/ship_station/models/carrier_spec.rb
173
+ - spec/ship_station/models/product_spec.rb
174
+ - spec/ship_station/models/fulfillment_spec.rb
175
+ - spec/ship_station/models/customer_spec.rb
176
+ - spec/ship_station/models/warehouse_spec.rb
177
+ - spec/ship_station/models/order_spec.rb
178
+ - spec/ship_station/models/store_spec.rb
179
+ - spec/ship_station/gem_spec.rb
180
+ - spec/ship_station/base_spec.rb
@@ -1,3 +0,0 @@
1
- module ShipStation
2
- class Tag < Model; end
3
- end