shipstation 0.25 → 0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -20
  3. data/Rakefile +30 -30
  4. data/lib/shipstation/api_operations/create.rb +10 -10
  5. data/lib/shipstation/api_operations/delete.rb +10 -10
  6. data/lib/shipstation/api_operations/list.rb +11 -11
  7. data/lib/shipstation/api_operations/retrieve.rb +10 -10
  8. data/lib/shipstation/api_operations/shipment.rb +10 -10
  9. data/lib/shipstation/api_operations/update.rb +9 -9
  10. data/lib/shipstation/api_resource.rb +7 -7
  11. data/lib/shipstation/carrier.rb +11 -11
  12. data/lib/shipstation/customer.rb +5 -5
  13. data/lib/shipstation/fulfillment.rb +16 -0
  14. data/lib/shipstation/order.rb +42 -42
  15. data/lib/shipstation/product.rb +6 -6
  16. data/lib/shipstation/shipment.rb +18 -18
  17. data/lib/shipstation/store.rb +14 -14
  18. data/lib/shipstation/tag.rb +11 -11
  19. data/lib/shipstation/version.rb +3 -3
  20. data/lib/shipstation/warehouse.rb +14 -14
  21. data/lib/shipstation/webhook.rb +18 -18
  22. data/lib/shipstation.rb +97 -96
  23. data/lib/tasks/shipstation_tasks.rake +4 -4
  24. data/test/dummy/Gemfile +54 -54
  25. data/test/dummy/Gemfile.lock +191 -191
  26. data/test/dummy/README.rdoc +28 -28
  27. data/test/dummy/Rakefile +6 -6
  28. data/test/dummy/app/assets/javascripts/application.js +16 -16
  29. data/test/dummy/app/assets/stylesheets/application.css +15 -15
  30. data/test/dummy/app/controllers/application_controller.rb +5 -5
  31. data/test/dummy/app/helpers/application_helper.rb +2 -2
  32. data/test/dummy/app/views/layouts/application.html.erb +14 -14
  33. data/test/dummy/bin/bundle +3 -3
  34. data/test/dummy/bin/rails +9 -9
  35. data/test/dummy/bin/rake +9 -9
  36. data/test/dummy/bin/setup +29 -29
  37. data/test/dummy/bin/spring +17 -17
  38. data/test/dummy/config/application.rb +26 -26
  39. data/test/dummy/config/boot.rb +3 -3
  40. data/test/dummy/config/database.yml +25 -25
  41. data/test/dummy/config/environment.rb +5 -5
  42. data/test/dummy/config/environments/development.rb +41 -41
  43. data/test/dummy/config/environments/production.rb +79 -79
  44. data/test/dummy/config/environments/test.rb +42 -42
  45. data/test/dummy/config/initializers/assets.rb +11 -11
  46. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -7
  47. data/test/dummy/config/initializers/cookies_serializer.rb +3 -3
  48. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -4
  49. data/test/dummy/config/initializers/inflections.rb +16 -16
  50. data/test/dummy/config/initializers/mime_types.rb +4 -4
  51. data/test/dummy/config/initializers/session_store.rb +3 -3
  52. data/test/dummy/config/initializers/shipstation.rb +1 -1
  53. data/test/dummy/config/initializers/wrap_parameters.rb +14 -14
  54. data/test/dummy/config/locales/en.yml +23 -23
  55. data/test/dummy/config/routes.rb +56 -56
  56. data/test/dummy/config/secrets.yml +22 -22
  57. data/test/dummy/config.ru +4 -4
  58. data/test/dummy/db/seeds.rb +7 -7
  59. data/test/dummy/public/404.html +67 -67
  60. data/test/dummy/public/422.html +67 -67
  61. data/test/dummy/public/500.html +66 -66
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/dummy/public/robots.txt +5 -5
  64. data/test/dummy/test/test_helper.rb +10 -10
  65. data/test/shipstation_test.rb +7 -7
  66. data/test/test_helper.rb +20 -20
  67. metadata +38 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b24a9b9d3b391332cb6aef90cd167a8a44953bad76cce01a74cda7af64c2674
4
- data.tar.gz: 36f0a87b41ac20872eefbed545126ed7360f8132a40813edcfe77abb7a6d46b3
3
+ metadata.gz: 7fbbbad38a2b68885c97c738c14691f9c6e95f7d834f93d7f251933d997f3fc5
4
+ data.tar.gz: b1c5fdd4b2f1d619fac852501f12da75039dd24c8946bef80a29f3ba98dd8c8e
5
5
  SHA512:
6
- metadata.gz: 41ad2642ef2ee4a4c1514ce7f2eb5c1043b24e88a8984ffb9e99e8bd8d7a7e3ac68fe31528cf3b2c1ff9f2bcabc9c49fbd815074ab60d7504974d69b1f156343
7
- data.tar.gz: c08b6326f2073f328964f3d5423a7f72995be83ef490dab293ba1f9e5e2512586d6d5f08bab54d8e27b8241636f91ed77ade10c071e3c47ecb759c050075a3cb
6
+ metadata.gz: 8c313885c15990f62029e903c29480fe3cb591ab58fdb3240be46d3547b8acab2a3bc913b4c43852d56efe23e5cd70a3842b0c94fd0f2ffbd1d42f0f810fb44a
7
+ data.tar.gz: f1de640fc4de7af0b8ee2a56c02cd23ef110b6efd3a23883dea7ade7bbcff760189cfa50745afbb15cae4881c84f1bae4ed64c27ac43f79779e4b122051dddc4
data/MIT-LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright 2016 Tom Dallimore
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright 2016 Tom Dallimore
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,30 +1,30 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'Shipstation'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
-
18
- Bundler::GemHelper.install_tasks
19
-
20
- require 'rake/testtask'
21
-
22
- Rake::TestTask.new(:test) do |t|
23
- t.libs << 'lib'
24
- t.libs << 'test'
25
- t.pattern = 'test/**/*_test.rb'
26
- t.verbose = false
27
- end
28
-
29
-
30
- task default: :test
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Shipstation'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+ Bundler::GemHelper.install_tasks
19
+
20
+ require 'rake/testtask'
21
+
22
+ Rake::TestTask.new(:test) do |t|
23
+ t.libs << 'lib'
24
+ t.libs << 'test'
25
+ t.pattern = 'test/**/*_test.rb'
26
+ t.verbose = false
27
+ end
28
+
29
+
30
+ task default: :test
@@ -1,11 +1,11 @@
1
- module Shipstation
2
- module APIOperations
3
- module Create
4
-
5
- def create(params = {})
6
- response = Shipstation.request(:post, "#{class_name.downcase.pluralize}/create#{class_name.downcase}", params)
7
- return response
8
- end
9
- end
10
- end
1
+ module Shipstation
2
+ module APIOperations
3
+ module Create
4
+
5
+ def create(params = {})
6
+ response = Shipstation.request(:post, "#{class_name.downcase.pluralize}/create#{class_name.downcase}", params)
7
+ return response
8
+ end
9
+ end
10
+ end
11
11
  end
@@ -1,11 +1,11 @@
1
- module Shipstation
2
- module APIOperations
3
- module Delete
4
-
5
- def delete(object_id, params = {})
6
- Shipstation.request(:delete, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
- end
8
-
9
- end
10
- end
1
+ module Shipstation
2
+ module APIOperations
3
+ module Delete
4
+
5
+ def delete(object_id, params = {})
6
+ Shipstation.request(:delete, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
+ end
8
+
9
+ end
10
+ end
11
11
  end
@@ -1,12 +1,12 @@
1
- module Shipstation
2
- module APIOperations
3
- module List
4
-
5
- def list(params = {})
6
- response = Shipstation.request(:get, class_name.downcase.pluralize, params)
7
-
8
- return response
9
- end
10
- end
11
- end
1
+ module Shipstation
2
+ module APIOperations
3
+ module List
4
+
5
+ def list(params = {})
6
+ response = Shipstation.request(:get, class_name.downcase.pluralize, params)
7
+
8
+ return response
9
+ end
10
+ end
11
+ end
12
12
  end
@@ -1,11 +1,11 @@
1
- module Shipstation
2
- module APIOperations
3
- module Retrieve
4
-
5
- def retrieve(object_id, params = {})
6
- response = Shipstation.request(:get, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
- return response
8
- end
9
- end
10
- end
1
+ module Shipstation
2
+ module APIOperations
3
+ module Retrieve
4
+
5
+ def retrieve(object_id, params = {})
6
+ response = Shipstation.request(:get, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
+ return response
8
+ end
9
+ end
10
+ end
11
11
  end
@@ -1,10 +1,10 @@
1
- module Shipstation
2
- module APIOperations
3
- module Shipment
4
-
5
- def mark_as_shipped(params = {})
6
- Shipstation.request(:post, 'orders/markasshipped', params)
7
- end
8
- end
9
- end
10
- end
1
+ module Shipstation
2
+ module APIOperations
3
+ module Shipment
4
+
5
+ def mark_as_shipped(params = {})
6
+ Shipstation.request(:post, 'orders/markasshipped', params)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
- module Shipstation
2
- module APIOperations
3
- module Update
4
-
5
- def update(object_id, params = {})
6
- Shipstation.request(:put, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
- end
8
- end
9
- end
1
+ module Shipstation
2
+ module APIOperations
3
+ module Update
4
+
5
+ def update(object_id, params = {})
6
+ Shipstation.request(:put, "#{class_name.downcase.pluralize}/#{object_id}", params)
7
+ end
8
+ end
9
+ end
10
10
  end
@@ -1,8 +1,8 @@
1
- module Shipstation
2
- class ApiResource
3
-
4
- def self.class_name
5
- self.name.split('::')[-1]
6
- end
7
- end
1
+ module Shipstation
2
+ class ApiResource
3
+
4
+ def self.class_name
5
+ self.name.split('::')[-1]
6
+ end
7
+ end
8
8
  end
@@ -1,12 +1,12 @@
1
- module Shipstation
2
- class Carrier < ApiResource
3
- extend Shipstation::APIOperations::List
4
-
5
- class << self
6
- def list_services(params = {})
7
- response = Shipstation.request(:get, 'carriers/listservices', params)
8
- return response
9
- end
10
- end
11
- end
1
+ module Shipstation
2
+ class Carrier < ApiResource
3
+ extend Shipstation::APIOperations::List
4
+
5
+ class << self
6
+ def list_services(params = {})
7
+ response = Shipstation.request(:get, 'carriers/listservices', params)
8
+ return response
9
+ end
10
+ end
11
+ end
12
12
  end
@@ -1,6 +1,6 @@
1
- module Shipstation
2
- class Customer < ApiResource
3
- extend Shipstation::APIOperations::List
4
- extend Shipstation::APIOperations::Retrieve
5
- end
1
+ module Shipstation
2
+ class Customer < ApiResource
3
+ extend Shipstation::APIOperations::List
4
+ extend Shipstation::APIOperations::Retrieve
5
+ end
6
6
  end
@@ -0,0 +1,16 @@
1
+ module Shipstation
2
+ class Fulfillment < ApiResource
3
+ extend Shipstation::APIOperations::List
4
+
5
+ class << self
6
+ def retrieve(object_id, params = {})
7
+ response = Shipstation.request(:get, "#{class_name.downcase.pluralize}?fulfillmentId=#{object_id}", params)
8
+ if response.is_a?(Hash) && response["fulfillments"].is_a?(Array)
9
+ response["fulfillments"].first
10
+ else
11
+ response
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,42 +1,42 @@
1
- # frozen_string_literal: true
2
-
3
- module Shipstation
4
- class Order < ApiResource
5
- extend Shipstation::APIOperations::List
6
- extend Shipstation::APIOperations::Create
7
- extend Shipstation::APIOperations::Retrieve
8
- extend Shipstation::APIOperations::Delete
9
-
10
- class << self
11
- def create_label(params = {})
12
- response = Shipstation.request(:post, 'orders/createlabelfororder', params)
13
-
14
- response
15
- end
16
-
17
- def assign_tag(params = {})
18
- response = Shipstation.request(:post, 'orders/addtag', params)
19
-
20
- response
21
- end
22
-
23
- def remove_tag(params = {})
24
- response = Shipstation.request(:post, 'orders/removetag', params)
25
-
26
- response
27
- end
28
-
29
- def create_bulk(params = {})
30
- response = Shipstation.request(:post, 'orders/createorders', params)
31
-
32
- response
33
- end
34
-
35
- # params: { [:username], [:password], input: [ {:order_number, ... }, { :order_number, ... } ] }
36
- # todo: complete in future phase
37
- # def create_update_orders params
38
- # Shipstation.request(:post, "orders/createorders", params)
39
- # end
40
- end
41
- end
42
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Shipstation
4
+ class Order < ApiResource
5
+ extend Shipstation::APIOperations::List
6
+ extend Shipstation::APIOperations::Create
7
+ extend Shipstation::APIOperations::Retrieve
8
+ extend Shipstation::APIOperations::Delete
9
+
10
+ class << self
11
+ def create_label(params = {})
12
+ response = Shipstation.request(:post, 'orders/createlabelfororder', params)
13
+
14
+ response
15
+ end
16
+
17
+ def assign_tag(params = {})
18
+ response = Shipstation.request(:post, 'orders/addtag', params)
19
+
20
+ response
21
+ end
22
+
23
+ def remove_tag(params = {})
24
+ response = Shipstation.request(:post, 'orders/removetag', params)
25
+
26
+ response
27
+ end
28
+
29
+ def create_bulk(params = {})
30
+ response = Shipstation.request(:post, 'orders/createorders', params)
31
+
32
+ response
33
+ end
34
+
35
+ # params: { [:username], [:password], input: [ {:order_number, ... }, { :order_number, ... } ] }
36
+ # todo: complete in future phase
37
+ # def create_update_orders params
38
+ # Shipstation.request(:post, "orders/createorders", params)
39
+ # end
40
+ end
41
+ end
42
+ end
@@ -1,7 +1,7 @@
1
- module Shipstation
2
- class Product < ApiResource
3
- extend Shipstation::APIOperations::List
4
- extend Shipstation::APIOperations::Retrieve
5
- extend Shipstation::APIOperations::Update
6
- end
1
+ module Shipstation
2
+ class Product < ApiResource
3
+ extend Shipstation::APIOperations::List
4
+ extend Shipstation::APIOperations::Retrieve
5
+ extend Shipstation::APIOperations::Update
6
+ end
7
7
  end
@@ -1,19 +1,19 @@
1
- module Shipstation
2
- class Shipment < ApiResource
3
- extend Shipstation::APIOperations::List
4
-
5
- class << self
6
- def get_rates(params = {})
7
- Shipstation.request(:post, "shipments/getrates", params)
8
- end
9
-
10
- def create_label(params = {})
11
- Shipstation.request(:post, 'shipments/createlabel', params)
12
- end
13
-
14
- def void_label(params = {})
15
- Shipstation.request(:post, 'shipments/voidlabel', params)
16
- end
17
- end
18
- end
1
+ module Shipstation
2
+ class Shipment < ApiResource
3
+ extend Shipstation::APIOperations::List
4
+
5
+ class << self
6
+ def get_rates(params = {})
7
+ Shipstation.request(:post, "shipments/getrates", params)
8
+ end
9
+
10
+ def create_label(params = {})
11
+ Shipstation.request(:post, 'shipments/createlabel', params)
12
+ end
13
+
14
+ def void_label(params = {})
15
+ Shipstation.request(:post, 'shipments/voidlabel', params)
16
+ end
17
+ end
18
+ end
19
19
  end
@@ -1,15 +1,15 @@
1
- module Shipstation
2
- class Store < ApiResource
3
- extend Shipstation::APIOperations::List
4
- extend Shipstation::APIOperations::Retrieve
5
- extend Shipstation::APIOperations::Update
6
-
7
- class << self
8
- def list(params = {})
9
- response = Shipstation.request(:get, 'stores', params)
10
-
11
- return response
12
- end
13
- end
14
- end
1
+ module Shipstation
2
+ class Store < ApiResource
3
+ extend Shipstation::APIOperations::List
4
+ extend Shipstation::APIOperations::Retrieve
5
+ extend Shipstation::APIOperations::Update
6
+
7
+ class << self
8
+ def list(params = {})
9
+ response = Shipstation.request(:get, 'stores', params)
10
+
11
+ return response
12
+ end
13
+ end
14
+ end
15
15
  end
@@ -1,12 +1,12 @@
1
- module Shipstation
2
- class Tag < ApiResource
3
-
4
- class << self
5
- def list(params = {})
6
- response = Shipstation.request(:get, 'accounts/listtags', params)
7
-
8
- return response
9
- end
10
- end
11
- end
1
+ module Shipstation
2
+ class Tag < ApiResource
3
+
4
+ class << self
5
+ def list(params = {})
6
+ response = Shipstation.request(:get, 'accounts/listtags', params)
7
+
8
+ return response
9
+ end
10
+ end
11
+ end
12
12
  end
@@ -1,3 +1,3 @@
1
- module Shipstation
2
- VERSION = "0.25"
3
- end
1
+ module Shipstation
2
+ VERSION = "0.26"
3
+ end
@@ -1,15 +1,15 @@
1
- module Shipstation
2
- class Warehouse < ApiResource
3
- extend Shipstation::APIOperations::Create
4
- extend Shipstation::APIOperations::Retrieve
5
- extend Shipstation::APIOperations::Update
6
-
7
- class << self
8
- def list(params = {})
9
- response = Shipstation.request(:get, 'warehouses', params)
10
-
11
- return response
12
- end
13
- end
14
- end
1
+ module Shipstation
2
+ class Warehouse < ApiResource
3
+ extend Shipstation::APIOperations::Create
4
+ extend Shipstation::APIOperations::Retrieve
5
+ extend Shipstation::APIOperations::Update
6
+
7
+ class << self
8
+ def list(params = {})
9
+ response = Shipstation.request(:get, 'warehouses', params)
10
+
11
+ return response
12
+ end
13
+ end
14
+ end
15
15
  end
@@ -1,19 +1,19 @@
1
- module Shipstation
2
- class Webhook < ApiResource
3
- extend Shipstation::APIOperations::List
4
-
5
- class << self
6
- def subscribe(params={})
7
- response = Shipstation.request(:post, 'webhooks/subscribe', params)
8
-
9
- return response
10
- end
11
-
12
- def unsubscribe(object_id, params={})
13
- response = Shipstation.request(:delete, "webhooks/#{object_id}", params)
14
-
15
- return response
16
- end
17
- end
18
- end
1
+ module Shipstation
2
+ class Webhook < ApiResource
3
+ extend Shipstation::APIOperations::List
4
+
5
+ class << self
6
+ def subscribe(params={})
7
+ response = Shipstation.request(:post, 'webhooks/subscribe', params)
8
+
9
+ return response
10
+ end
11
+
12
+ def unsubscribe(object_id, params={})
13
+ response = Shipstation.request(:delete, "webhooks/#{object_id}", params)
14
+
15
+ return response
16
+ end
17
+ end
18
+ end
19
19
  end