fifthgear 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +0 -2
- data/fifthgear.gemspec +2 -2
- data/lib/config/defaults.yml +1 -0
- data/lib/fifthgear.rb +3 -4
- data/lib/fifthgear/client.rb +5 -1
- data/lib/fifthgear/configuration.rb +7 -1
- data/lib/fifthgear/order_status_by_ref_number.rb +6 -1
- data/lib/fifthgear/version.rb +1 -1
- data/spec/fifthgear/configuration_spec.rb +23 -17
- data/spec/fifthgear/fifthgear_spec.rb +84 -28
- data/spec/spec_helper.rb +0 -1
- metadata +5 -18
- data/spec/fifthgear/cart_spec.rb +0 -13
- data/spec/fifthgear/item_inventory_bulk_spec.rb +0 -13
- data/spec/fifthgear/item_inventory_spec.rb +0 -13
- data/spec/fifthgear/item_lookup_spec.rb +0 -13
- data/spec/fifthgear/item_personalization_data_spec.rb +0 -13
- data/spec/fifthgear/order_status_bulk_spec.rb +0 -13
- data/spec/fifthgear/order_status_by_ref_number_spec.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 060324884f8ae0dacc043653459efd2e53f9b9dd
|
4
|
+
data.tar.gz: e1298c4eb229c8ad03a9795bb57e7efbe449b537
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09af8895d04eaecb98f28ca176c1aee9af44ed1b43e82c0e847eeda45a55a381d048feb2b1517e2944d054aaa0a4f9fa48884380d75f43a7279d9fea8d819aad
|
7
|
+
data.tar.gz: 7b6a6996ac3e84b9b28bd81f820e03c7c2ee0ab18c1da5f3a7b39dd436e7d843e61ecca9441c658f437dc435d6bf49d35c09e7b0ac4ad1ca7b4f85ad3f42e514
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/fifthgear.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'fifthgear/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "fifthgear"
|
8
8
|
spec.version = Fifthgear::VERSION
|
9
|
-
spec.authors = ["Tom Hanley"]
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Tom Hanley", "Walker and Company"]
|
10
|
+
spec.email = ["webops@walkerandcobrands.com"]
|
11
11
|
spec.summary = %q{Gem for interfacing with Fifthgear's API.}
|
12
12
|
spec.description = %q{Create objects in Fifthgear's fulfillment system}
|
13
13
|
spec.homepage = "https://github.com/WalkerAndCoBrandsInc/fifthgear"
|
data/lib/config/defaults.yml
CHANGED
data/lib/fifthgear.rb
CHANGED
@@ -47,16 +47,15 @@ module Fifthgear
|
|
47
47
|
Fifthgear::ItemPersonalizationData.export(sku)
|
48
48
|
end
|
49
49
|
|
50
|
-
def self.
|
51
|
-
Fifthgear::
|
50
|
+
def self.order_status_by_ref_number_lookup(orderRefNumber=nil)
|
51
|
+
Fifthgear::OrderStatusByRefNumber.lookup(orderRefNumber)
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.order_status_bulk_lookup(fromDate=nil, toDate=nil, startRange=nil, endRange=nil)
|
55
|
-
Fifthgear::
|
55
|
+
Fifthgear::OrderStatusBulk.lookup(fromDate, toDate, startRange, endRange)
|
56
56
|
end
|
57
57
|
|
58
58
|
def self.cart_submit(cart={})
|
59
59
|
Fifthgear::Cart.submit(cart)
|
60
60
|
end
|
61
|
-
|
62
61
|
end
|
data/lib/fifthgear/client.rb
CHANGED
@@ -12,11 +12,15 @@ module Fifthgear
|
|
12
12
|
# response defs
|
13
13
|
faraday.use Faraday::Response::ParseJson
|
14
14
|
faraday.use Faraday::Response::Mashify
|
15
|
-
faraday.use Faraday::Response::RaiseError
|
15
|
+
faraday.use Faraday::Response::RaiseError if Fifthgear.configuration.raise_errors
|
16
16
|
faraday.response :logger if Fifthgear.configuration.debug
|
17
17
|
|
18
18
|
faraday.headers['Content-Type'] = Fifthgear.configuration.content_type
|
19
19
|
faraday.adapter ::Faraday.default_adapter
|
20
|
+
|
21
|
+
# timeout options are in seconds
|
22
|
+
faraday.options.timeout = Fifthgear.configuration.timeout
|
23
|
+
faraday.options.open_timeout = Fifthgear.configuration.open_timeout
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -2,17 +2,23 @@ require 'yaml'
|
|
2
2
|
|
3
3
|
module Fifthgear
|
4
4
|
class Configuration
|
5
|
-
attr_accessor :api_root, :api_version, :username, :password,
|
5
|
+
attr_accessor :api_root, :api_version, :username, :password,
|
6
|
+
:content_type, :company_id, :debug, :raise_errors,
|
7
|
+
:timeout, :open_timeout
|
6
8
|
|
7
9
|
def initialize
|
8
10
|
defaults = load_defaults
|
9
11
|
@api_root = defaults[:api_root]
|
10
12
|
@api_version = defaults[:api_version]
|
11
13
|
@content_type = defaults[:content_type]
|
14
|
+
@raise_errors = defaults[:raise_errors]
|
15
|
+
@timeout = defaults[:timeout]
|
16
|
+
@open_timeout = defaults[:open_timeout]
|
12
17
|
@debug = false
|
13
18
|
end
|
14
19
|
|
15
20
|
private
|
21
|
+
|
16
22
|
def load_defaults
|
17
23
|
YAML.load_file(File.join(File.dirname(__FILE__),'..','config','defaults.yml'))
|
18
24
|
end
|
@@ -1,8 +1,13 @@
|
|
1
1
|
module Fifthgear
|
2
2
|
class OrderStatusByRefNumber
|
3
|
-
def self.
|
3
|
+
def self.lookup(orderRefNumber=nil)
|
4
4
|
conn = Fifthgear::Client.new
|
5
5
|
conn.post "#{Fifthgear.configuration.api_version}/OrderStatusLookupByRefNumber", { "CompanyId" => Fifthgear.configuration.company_id, "Request" => orderRefNumber}
|
6
6
|
end
|
7
|
+
|
8
|
+
def self.get(orderRefNumber=nil)
|
9
|
+
warn "Fifthgear::OrderStatusByRefNumber.get is deprecated, use .lookup"
|
10
|
+
lookup(orderRefNumber)
|
11
|
+
end
|
7
12
|
end
|
8
13
|
end
|
data/lib/fifthgear/version.rb
CHANGED
@@ -7,26 +7,32 @@ module Fifthgear
|
|
7
7
|
let(:password) {'rubin'}
|
8
8
|
let(:company_id) {'company123'}
|
9
9
|
let(:content_type) {'application/json'}
|
10
|
+
let(:raise_errors) { true }
|
11
|
+
let(:timeout) { 5 }
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
13
|
+
it 'has default values' do
|
14
|
+
expect(Configuration.new.api_root).to eq(api_root)
|
15
|
+
expect(Configuration.new.content_type).to eq(content_type)
|
16
|
+
expect(Configuration.new.raise_errors).to eq(false)
|
16
17
|
end
|
17
|
-
describe '#api_root=' do
|
18
|
-
it 'can set value' do
|
19
|
-
config = Configuration.new
|
20
|
-
config.api_root = api_root
|
21
|
-
config.username = username
|
22
|
-
config.password = password
|
23
|
-
config.company_id = company_id
|
24
18
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
it 'can set values' do
|
20
|
+
config = Configuration.new
|
21
|
+
config.api_root = api_root
|
22
|
+
config.username = username
|
23
|
+
config.password = password
|
24
|
+
config.company_id = company_id
|
25
|
+
config.raise_errors = raise_errors
|
26
|
+
config.timeout = timeout
|
27
|
+
config.open_timeout = timeout
|
28
|
+
|
29
|
+
expect(config.api_root).to eq(api_root)
|
30
|
+
expect(config.username).to eq(username)
|
31
|
+
expect(config.password).to eq(password)
|
32
|
+
expect(config.company_id).to eq(company_id)
|
33
|
+
expect(config.raise_errors).to eq(raise_errors)
|
34
|
+
expect(config.timeout).to eq(timeout)
|
35
|
+
expect(config.open_timeout).to eq(timeout)
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
@@ -1,32 +1,88 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module Fifthgear
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
4
|
+
describe "#configure" do
|
5
|
+
before do
|
6
|
+
Fifthgear.configure do |config|
|
7
|
+
config.api_root = 'https://commerceservicestest.infifthgear.com/v2.0/CommerceServices.svc/Rest'
|
8
|
+
config.username = 'mork'
|
9
|
+
config.password = 'foobarf'
|
10
|
+
config.content_type = 'text/json'
|
11
|
+
config.company_id = 'CompanyID'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
describe "#reset" do
|
16
|
+
before do
|
17
|
+
Fifthgear.configure do |config|
|
18
|
+
config.api_root = 'https://commerceservicestest.infifthgear.com/v2.0/CommerceServices.svc/Rest'
|
19
|
+
config.username = 'mork'
|
20
|
+
config.password = 'foobarf'
|
21
|
+
config.content_type = 'text/json'
|
22
|
+
config.company_id = 'CompanyID'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "resets the configuration" do
|
27
|
+
Fifthgear.reset
|
28
|
+
config = Fifthgear.configuration
|
29
|
+
expect(config.username).to be(nil)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe ".item_lookup" do
|
34
|
+
it "should not be nil" do
|
35
|
+
item = Fifthgear.item_lookup('testsku')
|
36
|
+
|
37
|
+
expect(item).to_not eq(nil)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ".cart_submit" do
|
42
|
+
it "should not be nil" do
|
43
|
+
order_obj = Fifthgear.cart_submit({})
|
44
|
+
|
45
|
+
expect(order_obj).to_not eq(nil)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe ".item_inventory_bulk_lookup" do
|
50
|
+
it "should not be nil" do
|
51
|
+
item = Fifthgear.item_inventory_bulk_lookup('testsku')
|
52
|
+
|
53
|
+
expect(item).to_not eq(nil)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe ".item_inventory_lookup" do
|
58
|
+
it "should not be nil" do
|
59
|
+
item = Fifthgear.item_inventory_lookup('testsku')
|
60
|
+
|
61
|
+
expect(item).to_not eq(nil)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe ".item_personalization_data_export" do
|
66
|
+
it "should not be nil" do
|
67
|
+
item = Fifthgear.item_personalization_data_export('testsku')
|
68
|
+
|
69
|
+
expect(item).to_not eq(nil)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "order_status_bulk_lookup" do
|
74
|
+
it "should not be nil" do
|
75
|
+
item = Fifthgear.order_status_bulk_lookup('testsku')
|
76
|
+
|
77
|
+
expect(item).to_not eq(nil)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe ".order_status_by_ref_number_lookup" do
|
82
|
+
it "should not be nil" do
|
83
|
+
item = Fifthgear.order_status_by_ref_number_lookup('testsku')
|
84
|
+
|
85
|
+
expect(item).to_not eq(nil)
|
86
|
+
end
|
87
|
+
end
|
32
88
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,7 +7,6 @@ require "fifthgear"
|
|
7
7
|
#
|
8
8
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
9
|
RSpec.configure do |config|
|
10
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
10
|
config.run_all_when_everything_filtered = true
|
12
11
|
config.filter_run :focus
|
13
12
|
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fifthgear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Hanley
|
8
|
+
- Walker and Company
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2016-07-08 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -96,7 +97,7 @@ dependencies:
|
|
96
97
|
version: '3.3'
|
97
98
|
description: Create objects in Fifthgear's fulfillment system
|
98
99
|
email:
|
99
|
-
-
|
100
|
+
- webops@walkerandcobrands.com
|
100
101
|
executables: []
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
@@ -123,16 +124,9 @@ files:
|
|
123
124
|
- lib/fifthgear/order_status_bulk.rb
|
124
125
|
- lib/fifthgear/order_status_by_ref_number.rb
|
125
126
|
- lib/fifthgear/version.rb
|
126
|
-
- spec/fifthgear/cart_spec.rb
|
127
127
|
- spec/fifthgear/client_spec.rb
|
128
128
|
- spec/fifthgear/configuration_spec.rb
|
129
129
|
- spec/fifthgear/fifthgear_spec.rb
|
130
|
-
- spec/fifthgear/item_inventory_bulk_spec.rb
|
131
|
-
- spec/fifthgear/item_inventory_spec.rb
|
132
|
-
- spec/fifthgear/item_lookup_spec.rb
|
133
|
-
- spec/fifthgear/item_personalization_data_spec.rb
|
134
|
-
- spec/fifthgear/order_status_bulk_spec.rb
|
135
|
-
- spec/fifthgear/order_status_by_ref_number_spec.rb
|
136
130
|
- spec/spec_helper.rb
|
137
131
|
homepage: https://github.com/WalkerAndCoBrandsInc/fifthgear
|
138
132
|
licenses:
|
@@ -154,19 +148,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
148
|
version: '0'
|
155
149
|
requirements: []
|
156
150
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.2.3
|
158
152
|
signing_key:
|
159
153
|
specification_version: 4
|
160
154
|
summary: Gem for interfacing with Fifthgear's API.
|
161
155
|
test_files:
|
162
|
-
- spec/fifthgear/cart_spec.rb
|
163
156
|
- spec/fifthgear/client_spec.rb
|
164
157
|
- spec/fifthgear/configuration_spec.rb
|
165
158
|
- spec/fifthgear/fifthgear_spec.rb
|
166
|
-
- spec/fifthgear/item_inventory_bulk_spec.rb
|
167
|
-
- spec/fifthgear/item_inventory_spec.rb
|
168
|
-
- spec/fifthgear/item_lookup_spec.rb
|
169
|
-
- spec/fifthgear/item_personalization_data_spec.rb
|
170
|
-
- spec/fifthgear/order_status_bulk_spec.rb
|
171
|
-
- spec/fifthgear/order_status_by_ref_number_spec.rb
|
172
159
|
- spec/spec_helper.rb
|
data/spec/fifthgear/cart_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Fifthgear
|
4
|
-
describe Cart do
|
5
|
-
describe "#post" do
|
6
|
-
it "should return an order object" do
|
7
|
-
pending "Configuration isn't passing username and password to client."
|
8
|
-
order_obj = Fifthgear.cart_submit({})
|
9
|
-
expect(order_obj).to_not eq(nil)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Fifthgear
|
4
|
-
describe ItemInventoryBulk do
|
5
|
-
describe "#get" do
|
6
|
-
it "should return details about item" do
|
7
|
-
pending "Configuration isn't passing username and password to client."
|
8
|
-
item = Fifthgear.item_inventory_bulk_lookup('testsku')
|
9
|
-
expect(item).to_not eq(nil)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Fifthgear
|
4
|
-
describe ItemInventory do
|
5
|
-
describe "#get" do
|
6
|
-
it "should return details about item" do
|
7
|
-
pending "Configuration isn't passing username and password to client."
|
8
|
-
item = Fifthgear.item_inventory_lookup('testsku')
|
9
|
-
expect(item).to_not eq(nil)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Fifthgear
|
4
|
-
describe Item do
|
5
|
-
describe "#get" do
|
6
|
-
it "should return an item" do
|
7
|
-
pending "Configuration isn't passing username and password to client."
|
8
|
-
item = Fifthgear.item_lookup('testsku')
|
9
|
-
expect(item).to_not eq(nil)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Fifthgear
|
4
|
-
describe ItemPersonalizationData do
|
5
|
-
describe "#get" do
|
6
|
-
it "should return an item" do
|
7
|
-
pending "Configuration isn't passing username and password to client."
|
8
|
-
item = Fifthgear.item_personalization_data_export('testsku')
|
9
|
-
expect(item).to_not eq(nil)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Fifthgear
|
4
|
-
describe OrderStatusBulk do
|
5
|
-
describe "#get" do
|
6
|
-
it "should return an item" do
|
7
|
-
pending "Configuration isn't passing username and password to client."
|
8
|
-
item = Fifthgear.order_status_bulk_lookup('testsku')
|
9
|
-
expect(item).to_not eq(nil)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Fifthgear
|
4
|
-
describe OrderStatusByRefNumber do
|
5
|
-
describe "#lookup" do
|
6
|
-
it "should return an item" do
|
7
|
-
pending "Configuration isn't passing username and password to client."
|
8
|
-
item = Fifthgear.order_status_lookup_by_ref_number('testsku')
|
9
|
-
expect(item).to_not eq(nil)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|