trebbianno-ruby-api 0.0.3 → 0.0.4

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: a26aa6a1cbf26d5ab2bef8cec58a3acfbd2e3409
4
- data.tar.gz: 9b1b98cf6e8c00e1a2d51480997662ba78f3085e
3
+ metadata.gz: c9a5498fa78f924826a897a57681ffdf8aafa888
4
+ data.tar.gz: 253f986e3c9fd7b17acfe916ebb7882a7c666014
5
5
  SHA512:
6
- metadata.gz: 61afc7a68a57022a02f0933b671e4b3c86381a07dde522f28698d35aa5811b608158002e9aaf55ee091696b0fe8eb9da1683460adbb3a77dfca276064a6d61fc
7
- data.tar.gz: dfa97b67f9f87258c82ebfce2d92ede908e9e319227d721c1625f5210cb40f85a77a17088df19e3464080042f338433446076acb479eb42262bf82f2b921e59a
6
+ metadata.gz: 6ad558be3c3b0bf57a4d7f6bc6135a1c67f5db5ea940d8bd167b8b81d360f02a19d043e6842cea9d5625a9a8be8285228da8aab619fe327f5d6231fff5019db5
7
+ data.tar.gz: d7f242886986fff9db478670090f473277dbe4dbe645bb97d18e5d8c941297ba3dac7cf1e00e8a06df735c93fdea5cd3e5f595ac839857c890fb483619f938b2
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.5
@@ -45,7 +45,7 @@ module Trebbianno
45
45
  'SA' => 'SD', # SAUDI ARABIA
46
46
  'BH' => 'BA', # BAHRAIN
47
47
  'HN' => 'HO', # HONDURAS
48
- 'CA' => 'CA', # CANADA
48
+ 'CA' => 'CA', # CANADA
49
49
  'JP' => 'JP', # JAPAN
50
50
  'KW' => 'KU', # KUWAIT
51
51
  'LB' => 'LB', # LEBANON
@@ -83,7 +83,6 @@ module Trebbianno
83
83
  'FR' => 'FR', # FRANCE
84
84
  'GB' => 'UK', # UNITED KINGDOM
85
85
  'AR' => 'AR', # ARGENTINA
86
- 'GT' => 'GT', # GUATEMALA
87
86
  'SV' => 'EL', # EL SALVADOR
88
87
  'KR' => 'SK', # SOUTH KOREA - REPUBLIC OF KOREA
89
88
  'IE' => 'IRL', # IRELAND
@@ -15,9 +15,10 @@ module Trebbianno
15
15
  build_address xml, address
16
16
  xml.customerref order[:number]
17
17
  xml.orderdate order[:date]
18
- xml.freightcharge order[:shipping_cost]
18
+ xml.freightcharge freight_charge(order)
19
19
  xml.ordernumber order[:number]
20
20
  xml.shipping_method order[:shipping_method]
21
+ xml.tax order[:tax]
21
22
 
22
23
  build_line_items xml, order
23
24
 
@@ -28,6 +29,10 @@ module Trebbianno
28
29
 
29
30
  private
30
31
 
32
+ def freight_charge(order)
33
+ order[:shipping_cost] - order[:shipping_discount].abs
34
+ end
35
+
31
36
  def build_address(xml, address)
32
37
  xml.addressline1 address[:address1]
33
38
  xml.addressline2 address[:address2]
@@ -44,10 +49,14 @@ module Trebbianno
44
49
  xml.ordernumber order[:number]
45
50
  xml.sku line_item[:sku]
46
51
  xml.qty line_item[:quantity]
47
- xml.unitprice line_item[:price]
52
+ xml.unitprice line_item[:price] - line_item_discount(order)
48
53
  end
49
54
  end
50
55
  end
51
56
 
57
+ def line_item_discount(order)
58
+ order[:item_discount].abs / order[:line_items].count
59
+ end
60
+
52
61
  end
53
62
  end
@@ -19,7 +19,8 @@ module Trebbianno
19
19
  end
20
20
 
21
21
  def parse_response(xml_response)
22
- return nil if xml_response.blank?
22
+ blank = xml_response.respond_to?(:empty?) ? !!xml_response.empty? : !xml_response
23
+ return nil if blank
23
24
  XmlSimple.xml_in(xml_response)
24
25
  end
25
26
 
@@ -1,3 +1,3 @@
1
1
  module Trebbianno
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0"?>
2
+ <stocklines>
3
+ <stock>
4
+ <stockid>840258104705</stockid>
5
+ <qty>4</qty>
6
+ </stock>
7
+ <stock>
8
+ <stockid>840258104712</stockid>
9
+ <qty>17</qty>
10
+ </stock>
11
+ <stock>
12
+ <stockid>840258104729</stockid>
13
+ <qty>17</qty>
14
+ </stock>
15
+ </stocklines>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0"?>
2
+ <stocklines>
3
+ <stock>
4
+ <stockid>840258101001</stockid>
5
+ <qty>4</qty>
6
+ </stock>
7
+ <stock>
8
+ <stockid>840258101002</stockid>
9
+ <qty>17</qty>
10
+ </stock>
11
+ <stock>
12
+ <stockid>840258101003</stockid>
13
+ <qty>17</qty>
14
+ </stock>
15
+ </stocklines>
@@ -0,0 +1 @@
1
+ <addressline1>123 Here Now</addressline1><addressline2>2nd Floor</addressline2><towncity>New York</towncity><state>NY</state><postcode>10012</postcode><country>US</country><contactphone>123-123-1234</contactphone>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <orders>
3
+ <order>
4
+ <user>the_username</user>
5
+ <password>the_password</password>
6
+ <name>John Smith</name>
7
+ <addressline1>123 Here Now</addressline1>
8
+ <addressline2>2nd Floor</addressline2>
9
+ <towncity>New York</towncity>
10
+ <state>NY</state>
11
+ <postcode>10012</postcode>
12
+ <country>US</country>
13
+ <contactphone>123-123-1234</contactphone>
14
+ <customerref>R123123123</customerref>
15
+ <orderdate>01-01-2016</orderdate>
16
+ <freightcharge>30</freightcharge>
17
+ <ordernumber>R123123123</ordernumber>
18
+ <shipping_method>UPS AIR</shipping_method>
19
+ <tax>20</tax>
20
+ <orderline>
21
+ <ordernumber>R123123123</ordernumber>
22
+ <sku>123332211</sku>
23
+ <qty>1</qty>
24
+ <unitprice>80</unitprice>
25
+ </orderline>
26
+ <orderline>
27
+ <ordernumber>R123123123</ordernumber>
28
+ <sku>123332212</sku>
29
+ <qty>1</qty>
30
+ <unitprice>180</unitprice>
31
+ </orderline>
32
+ </order>
33
+ </orders>
@@ -1,95 +1,87 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Trebbianno::Client do
4
- before do
5
- @client = Trebbianno::Client.new("the_username", "the_password")
6
- end
4
+ let(:client) { Trebbianno::Client.new("the_username", "the_password") }
7
5
 
8
6
  describe '#send_order_request' do
9
7
  it 'should send order request and return parsed respose' do
10
8
  Trebbianno::Order.any_instance.should_receive(:build_order_request).with(order_hash)
11
- @client.should_receive(:post)
12
- @client.send_order_request(order_hash)
9
+ expect(client).to receive(:post)
10
+ client.send_order_request(order_hash)
11
+ end
12
+ end
13
+
14
+ describe '#get_inventory' do
15
+
16
+ let(:expected_result) do
17
+ [
18
+ {"upc"=>"840258104705", "qty"=>"4"},
19
+ {"upc"=>"840258104712", "qty"=>"17"},
20
+ {"upc"=>"840258104729", "qty"=>"17"}
21
+ ]
22
+ end
23
+
24
+ let(:inventory) { read_xml(:inventory_fixture_1) }
25
+
26
+ before do
27
+ stub_request(:post, "http://the_username:the_password@54.235.241.72:4081/Inventory").
28
+ with(body: inventory_request, headers: request_headers).
29
+ to_return(status: 200, body: inventory, headers: {})
30
+ end
31
+
32
+ it 'should send inventory to client' do
33
+ expect(client.get_inventory).to eq(expected_result)
13
34
  end
14
35
  end
15
36
 
16
37
  describe 'private#default_options' do
17
38
  it 'should return a hash' do
18
- @client.send(:default_options).should be_a Hash
39
+ expect(client.send(:default_options)).to be_a Hash
19
40
  end
20
41
  end
21
42
 
22
43
  describe 'private#testing?' do
23
44
  it 'should return boolean for test mode' do
24
- @client.send(:testing?).should be_false
25
- @client.instance_variable_set(:@options, { test_mode: true })
26
- @client.send(:testing?).should be_true
45
+ expect(client.send(:testing?)).to eq false
46
+
47
+ client.instance_variable_set(:@options, { test_mode: true })
48
+ expect(client.send(:testing?)).to eq true
27
49
  end
28
50
  end
29
51
 
30
52
  describe 'private#verbose?' do
31
53
  it 'should return boolean for verbose mode' do
32
- @client.send(:verbose?).should be_true
33
- @client.instance_variable_set(:@options, { verbose: false })
34
- @client.send(:verbose?).should be_false
54
+ expect(client.send(:verbose?)).to eq true
55
+
56
+ client.instance_variable_set(:@options, { verbose: false })
57
+ expect(client.send(:verbose?)).to eq false
35
58
  end
36
59
  end
37
60
 
38
61
  describe 'private#host' do
39
62
  it 'should' do
40
- @client.stub(:testing?).and_return(false)
41
- @client.send(:host).should == Trebbianno::Client::LIVE_HOST
42
- @client.stub(:testing?).and_return(true)
43
- @client.send(:host).should == Trebbianno::Client::TEST_HOST
63
+ client.stub(:testing?).and_return(false)
64
+ expect(client.send(:host)).to eq Trebbianno::Client::LIVE_HOST
65
+ client.stub(:testing?).and_return(true)
66
+ expect(client.send(:host)).to eq Trebbianno::Client::TEST_HOST
44
67
  end
45
68
  end
46
69
 
47
- describe 'private#path' do
48
- it 'should' do
49
- @client.stub(:testing?).and_return(false)
50
- @client.send(:path).should == Trebbianno::Client::LIVE_PATH
51
- @client.stub(:testing?).and_return(true)
52
- @client.send(:path).should == Trebbianno::Client::TEST_PATH
53
- end
54
- end
55
70
 
56
71
  describe 'private#log' do
57
72
  context 'not in verbose mode' do
58
73
  it 'should not log message' do
59
- @client.stub(:verbose?).and_return(false)
60
- @client.should_not_receive(:puts)
61
- @client.send(:log, "message")
74
+ client.stub(:verbose?).and_return(false)
75
+ expect(client).not_to receive(:puts)
76
+ client.send(:log, "message")
62
77
  end
63
78
  end
64
79
  context 'in verbose mode' do
65
80
  it 'should' do
66
- @client.stub(:verbose?).and_return(true)
67
- @client.should_receive(:puts).with("message")
68
- @client.send(:log, "message")
81
+ client.stub(:verbose?).and_return(true)
82
+ expect(client).to receive(:puts).with("message")
83
+ client.send(:log, "message")
69
84
  end
70
85
  end
71
86
  end
72
-
73
- describe 'private#post' do
74
- it 'should use net http to post xml request' do
75
- path = @client.send(:path)
76
- xml_request = "xml_request"
77
- response = Trebbianno::Response.new("<xml>body</xml>", "new_request")
78
- header = {'Content-Type' => 'text/xml'}
79
- Net::HTTP.any_instance.should_receive(:post).with(path, xml_request, header).and_return(response)
80
- @client.should_receive(:parse_response).with(response, nil)
81
- @client.should_receive(:log).with(response)
82
- @client.send(:post, xml_request)
83
- end
84
- end
85
-
86
- describe 'private#parse_response' do
87
- it 'should use xml simple to parse the response' do
88
- xml_response = "xml_response"
89
- XmlSimple.should_receive(:xml_in).with(xml_response)
90
- response = @client.send(:parse_response, xml_response)
91
- response.should be_a Trebbianno::Response
92
- end
93
- end
94
-
95
- end
87
+ end
@@ -2,34 +2,50 @@ require 'spec_helper'
2
2
 
3
3
  describe Trebbianno::Order do
4
4
 
5
- before do
6
- @client = Trebbianno::Client.new("the_username", "the_password")
7
- @order_client = Trebbianno::Order.new(@client)
8
- @xml = Builder::XmlMarkup.new
9
- end
5
+ let(:client) { Trebbianno::Client.new("the_username", "the_password") }
6
+ let(:order_client) { Trebbianno::Order.new(client) }
7
+ let(:xml) { Builder::XmlMarkup.new }
10
8
 
11
9
  describe '#build_order_request' do
12
10
  it 'should' do
13
- response = @order_client.build_order_request(order_hash)
14
- @client.type.should == "new_order_entry"
15
- request_body = xml_order_request_string(order_hash)
16
- response.should == xml_string("new_order_entry", request_body)
11
+ response = order_client.build_order_request(order_hash)
12
+ expect(response).to eq read_xml(:test_build_order_request)
17
13
  end
18
14
  end
19
15
 
20
16
  describe 'private#build_address' do
17
+ before do
18
+ xml = ::Builder::XmlMarkup.new :indent => 3
19
+ xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
20
+ end
21
21
  it 'should build the proper address xml' do
22
- type = "CUSTOMER"
23
- request = @order_client.send(:build_address, @xml, type, order_hash[:shipping_address])
24
- request.should == xml_address_string(type, order_hash[:shipping_address])
22
+ request = order_client.send(:build_address, xml, order_hash[:shipping_address])
23
+ expect(request).to eq read_xml(:test_build_address)
25
24
  end
26
25
  end
27
26
 
28
27
  describe 'private#build_line_items' do
29
28
  it 'should build the proper line items xml' do
30
- request = @order_client.send(:build_line_items, @xml, order_hash)
31
- request.should == xml_line_items_string(order_hash)
29
+ request = order_client.send(:build_line_items, xml, order_hash)
30
+ expect(request).to eq test_line_items_string(order_hash)
31
+ end
32
+ end
33
+
34
+ describe 'private#freight_charge' do
35
+ it 'should claculate freight charges for order' do
36
+ charge = order_client.send(:freight_charge, order_hash)
37
+ expect(charge).to eq 30
38
+ end
39
+ end
40
+
41
+ describe 'private#line_item_discount' do
42
+ let(:discount) {[20, 20]}
43
+ it 'should calculate discount price for line item' do
44
+ order_hash[:line_items].each_with_index do |item, index|
45
+ discount_amount = order_client.send(:line_item_discount, order_hash)
46
+ expect(discount_amount).to eq discount[index]
47
+ end
32
48
  end
33
49
  end
34
50
 
35
- end
51
+ end
data/spec/spec_helper.rb CHANGED
@@ -3,9 +3,13 @@
3
3
  # Require this file using `require "spec_helper"` to ensure that it is only
4
4
  # loaded once.
5
5
 
6
+ require 'codeclimate-test-reporter'
7
+ CodeClimate::TestReporter.start
6
8
  require 'rubygems'
7
9
  require 'bundler/setup'
8
10
  Bundler.require(:default, :development)
11
+ require 'rspec'
12
+ require 'webmock/rspec'
9
13
  require 'hashie'
10
14
  require 'trebbianno'
11
15
 
@@ -17,70 +21,31 @@ RSpec.configure do |config|
17
21
  config.order = 'random'
18
22
  end
19
23
 
20
- def xml_string(type, body)
21
- xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
22
- xml += "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:a=\"http://www.w3.org/2005/08/addressing\">"
23
- xml += xml_header_string(type)
24
- xml += "<s:Body><#{type} xmlns=\"SII\">"
25
- xml += xml_user_string
26
- xml += body
27
- xml += "</#{type}></s:Body></s:Envelope>"
24
+ def read_xml(type)
25
+ File.read( File.expand_path("spec/fixtures/#{type}.xml") )
28
26
  end
29
27
 
30
- def xml_header_string(type)
31
- xml = "<s:Header><a:Action s:mustUnderstand=\"1\">SII/ISIIService/#{type}</a:Action>"
32
- xml += "<a:MessageID>urn:uuid:56b55a70-8bbc-471d-94bb-9ca060bcf99f</a:MessageID>"
33
- xml += "<a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo>"
34
- xml += "<a:To s:mustUnderstand=\"1\">https://www.trebbianno.us/webservices/SIIService.svc</a:To></s:Header>"
28
+ def fixture(type)
29
+ XmlSimple.xml_in( read_xml(type) )
35
30
  end
36
31
 
37
- def xml_user_string
38
- xml = "<user xmlns:b=\"http://schemas.datacontract.org/2004/07/\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">"
39
- xml += "<b:user_name>&lt;![CDATA[the_username]]&gt;</b:user_name><b:user_password>&lt;![CDATA[the_password]]&gt;</b:user_password></user>"
40
- end
41
-
42
- def xml_address_string(type, address)
43
- full_name = "#{address[:first_name]} #{address[:last_name]}"
44
- xml = "<b:#{type}_NAME>&lt;![CDATA[#{full_name}]]&gt;</b:#{type}_NAME>"
45
- xml += "<b:#{type}_ADDRESS_1>&lt;![CDATA[#{address[:address1]}]]&gt;</b:#{type}_ADDRESS_1>"
46
- xml += "<b:#{type}_ADDRESS_2>&lt;![CDATA[#{address[:address2]}]]&gt;</b:#{type}_ADDRESS_2>"
47
- xml += "<b:#{type}_ADDRESS_3>&lt;![CDATA[#{address[:address3]}]]&gt;</b:#{type}_ADDRESS_3>"
48
- xml += "<b:#{type}_ADDRESS_CITY>#{address[:city]}</b:#{type}_ADDRESS_CITY>"
49
- xml += "<b:#{type}_ADDRESS_COUNTRY>#{address[:country]}</b:#{type}_ADDRESS_COUNTRY>"
50
- xml += "<b:#{type}_ADDRESS_STATE>#{address[:state]}</b:#{type}_ADDRESS_STATE>"
51
- xml += "<b:#{type}_ADDRESS_ZIP>#{address[:zipcode]}</b:#{type}_ADDRESS_ZIP>"
52
- xml += "<b:#{type}_TELEPHONE>#{address[:phone]}</b:#{type}_TELEPHONE>"
32
+ def test_line_items_string(order)
33
+ [].tap do |arr|
34
+ order[:line_items].each do |hash|
35
+ arr << { price: hash[:price],
36
+ quantity: hash[:quantity],
37
+ sku: hash[:sku],
38
+ size: hash[:size]}
39
+ end
40
+ end
53
41
  end
54
42
 
55
- def xml_line_items_string(order)
56
- xml = "<b:Order_Details>"
57
- order[:line_items].each do |line_item|
58
- xml += "<b:Order_Detail_New>"
59
- xml += "<b:PRICE>#{line_item[:price]}</b:PRICE>"
60
- xml += "<b:QUANTITY>#{line_item[:quantity]}</b:QUANTITY>"
61
- xml += "<b:SIZE>#{line_item[:size]}</b:SIZE>"
62
- xml += "<b:sku>#{line_item[:sku]}</b:sku>"
63
- xml += "</b:Order_Detail_New>"
64
- end
65
- xml += "</b:Order_Details>"
43
+ def request_headers
44
+ {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'text/xml', 'User-Agent'=>'Ruby'}
66
45
  end
67
46
 
68
- def xml_order_request_string(order)
69
- xml = "<ohn xmlns:b=\"http://schemas.datacontract.org/2004/07/\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">"
70
- xml += "<b:SERVICE>90</b:SERVICE>"
71
- xml += "<b:USER1>&lt;![CDATA[http://example.com/R123123123/invoice]]&gt;</b:USER1>"
72
- xml += "<b:CARRIER>FEDEX</b:CARRIER>"
73
- xml += "<b:CUSTOMER_CODE/><b:DELIVERY_GIFT_WRAP/>"
74
- xml += "<b:DELIVERY_MESSAGE>&lt;![CDATA[Happy Birthday!]]&gt;</b:DELIVERY_MESSAGE>"
75
- xml += "<b:EMAIL>someone@somehwere.com</b:EMAIL>"
76
- xml += "<b:ORDER_ID>R123123123</b:ORDER_ID>"
77
- xml += "<b:ORDER_TYPE>OO</b:ORDER_TYPE>"
78
- xml += "<b:DELIVERY_FROM i:nil=\"true\"/><b:DELIVERY_TO i:nil=\"true\"/>"
79
- xml += "<b:DELIVERY_ID i:nil=\"true\"/><b:FREIGHT_ACCOUNT i:nil=\"true\"/>"
80
- xml += xml_address_string("CUSTOMER", order[:billing_address])
81
- xml += xml_address_string("DELIVERY", order[:shipping_address])
82
- xml += xml_line_items_string(order)
83
- xml += "</ohn>"
47
+ def inventory_request
48
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<stock>\n</stock>\n"
84
49
  end
85
50
 
86
51
  def order_hash
@@ -93,7 +58,7 @@ def order_hash
93
58
  address2: "2nd Floor",
94
59
  address3: "",
95
60
  city: "New York",
96
- state: "New York",
61
+ state: "NY",
97
62
  country: "US",
98
63
  zipcode: "10012",
99
64
  phone: "123-123-1234"
@@ -115,12 +80,24 @@ def order_hash
115
80
  email: "someone@somehwere.com",
116
81
  number: "R123123123",
117
82
  type: "OO",
83
+ item_discount: 40,
84
+ shipping_cost: 30,
85
+ shipping_discount: 0,
86
+ tax: 20,
87
+ shipping_method: 'UPS AIR',
88
+ date: '01-01-2016',
118
89
  line_items: [
119
90
  {
120
- price: "127.23",
91
+ price: 100,
121
92
  quantity: "1",
122
93
  sku: "123332211",
123
94
  size: "XS"
95
+ },
96
+ {
97
+ price: 200,
98
+ quantity: "1",
99
+ sku: "123332212",
100
+ size: "XS"
124
101
  }
125
102
  ],
126
103
  shipping_code: "90",
data/trebbianno.gemspec CHANGED
@@ -19,8 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.add_dependency "builder"
20
20
  spec.add_dependency "xml-simple"
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "hashie"
23
+ spec.add_development_dependency "bundler", "~> 1.7"
23
24
  spec.add_development_dependency "rake"
24
25
  spec.add_development_dependency "rspec"
25
- spec.add_development_dependency "debugger"
26
+ spec.add_development_dependency "webmock"
27
+ spec.add_development_dependency "byebug"
28
+ spec.add_development_dependency "codeclimate-test-reporter"
26
29
  end
metadata CHANGED
@@ -1,97 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trebbianno-ruby-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Grubbs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2016-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: xml-simple
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hashie
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ~>
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '1.3'
61
+ version: '1.7'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ~>
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '1.3'
68
+ version: '1.7'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rspec
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '>='
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
74
116
  - !ruby/object:Gem::Version
75
117
  version: '0'
76
118
  type: :development
77
119
  prerelease: false
78
120
  version_requirements: !ruby/object:Gem::Requirement
79
121
  requirements:
80
- - - '>='
122
+ - - ">="
81
123
  - !ruby/object:Gem::Version
82
124
  version: '0'
83
125
  - !ruby/object:Gem::Dependency
84
- name: debugger
126
+ name: codeclimate-test-reporter
85
127
  requirement: !ruby/object:Gem::Requirement
86
128
  requirements:
87
- - - '>='
129
+ - - ">="
88
130
  - !ruby/object:Gem::Version
89
131
  version: '0'
90
132
  type: :development
91
133
  prerelease: false
92
134
  version_requirements: !ruby/object:Gem::Requirement
93
135
  requirements:
94
- - - '>='
136
+ - - ">="
95
137
  - !ruby/object:Gem::Version
96
138
  version: '0'
97
139
  description: Ruby Library for Trebbianno Fulfillment API
@@ -101,9 +143,10 @@ executables: []
101
143
  extensions: []
102
144
  extra_rdoc_files: []
103
145
  files:
104
- - .gitignore
105
- - .rspec
106
- - .travis.yml
146
+ - ".gitignore"
147
+ - ".rspec"
148
+ - ".ruby-version"
149
+ - ".travis.yml"
107
150
  - Gemfile
108
151
  - LICENSE.txt
109
152
  - README.md
@@ -118,9 +161,12 @@ files:
118
161
  - lib/trebbianno/state.rb
119
162
  - lib/trebbianno/tracking.rb
120
163
  - lib/trebbianno/version.rb
164
+ - spec/fixtures/inventory_fixture_1.xml
165
+ - spec/fixtures/inventory_fixture_2.xml
166
+ - spec/fixtures/test_build_address.xml
167
+ - spec/fixtures/test_build_order_request.xml
121
168
  - spec/lib/client_spec.rb
122
169
  - spec/lib/order_spec.rb
123
- - spec/lib/soap_spec.rb
124
170
  - spec/spec_helper.rb
125
171
  - trebbianno.gemspec
126
172
  homepage: http://sellect.com
@@ -133,22 +179,25 @@ require_paths:
133
179
  - lib
134
180
  required_ruby_version: !ruby/object:Gem::Requirement
135
181
  requirements:
136
- - - '>='
182
+ - - ">="
137
183
  - !ruby/object:Gem::Version
138
184
  version: '0'
139
185
  required_rubygems_version: !ruby/object:Gem::Requirement
140
186
  requirements:
141
- - - '>='
187
+ - - ">="
142
188
  - !ruby/object:Gem::Version
143
189
  version: '0'
144
190
  requirements: []
145
191
  rubyforge_project:
146
- rubygems_version: 2.2.2
192
+ rubygems_version: 2.4.8
147
193
  signing_key:
148
194
  specification_version: 4
149
195
  summary: This is a library for interfacing with the Trebbianno Fulfillment API
150
196
  test_files:
197
+ - spec/fixtures/inventory_fixture_1.xml
198
+ - spec/fixtures/inventory_fixture_2.xml
199
+ - spec/fixtures/test_build_address.xml
200
+ - spec/fixtures/test_build_order_request.xml
151
201
  - spec/lib/client_spec.rb
152
202
  - spec/lib/order_spec.rb
153
- - spec/lib/soap_spec.rb
154
203
  - spec/spec_helper.rb
@@ -1,39 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Trebbianno::Request do
4
-
5
- before do
6
- @client = Trebbianno::Client.new("the_username", "the_password")
7
- end
8
-
9
- describe '#construct_xml' do
10
- it 'should build the main xml with header, user, and supplied body' do
11
- request_type = "new_order_request"
12
- soap_client = Trebbianno::Request.new(@client)
13
- soap_request = soap_client.construct_xml request_type do |xml|
14
- xml.test "test"
15
- end
16
- soap_request.should == xml_string(request_type, "<test>test</test>")
17
- end
18
- end
19
-
20
- describe '#build_header' do
21
- it 'should build xml header' do
22
- request_type = "new_order_request"
23
- soap_client = Trebbianno::Request.new(@client)
24
- xml = Builder::XmlMarkup.new
25
- soap_request = soap_client.build_header(xml, request_type)
26
- soap_request.should == xml_header_string(request_type)
27
- end
28
- end
29
-
30
- describe '#build_user' do
31
- it 'should' do
32
- soap_client = Trebbianno::Request.new(@client)
33
- xml = Builder::XmlMarkup.new
34
- soap_request = soap_client.build_user(xml)
35
- soap_request.should == xml_user_string
36
- end
37
- end
38
-
39
- end