whitehouse 0.0.2 → 0.1.0

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: 5f00fb3cfe708e67a63a6282d84330b908fca9e5
4
- data.tar.gz: fd0c580e2219830fc47cd91f172b01c8128f710d
3
+ metadata.gz: 1a83e40583b0966e208d5be28e9cca2512830625
4
+ data.tar.gz: e3c9fbf7bf3d06264bf924c9c6b6426aa0594d56
5
5
  SHA512:
6
- metadata.gz: 01484f7f628c0125fada004ef248848787d04625ae48ba7481aa50fb974386ff4876c489ebcc06521f867787d39fae6a2873368be7d153ff2f7ab29845e70895
7
- data.tar.gz: 54566a37895fcf886304ac99910725ec7facb00aa140968271b911d32535fd3031b073c27b5789a5e15345971b8881c901f908134d29c131c2ffd9c5e275f299
6
+ metadata.gz: 5e347edb7f34928cb1315ed834ade6d233257959a0cb2dd5a899724c5a256ad7b24a1c13487b61dda546eab1c5d00ba51aa85b8228e487aea121302c917ba235
7
+ data.tar.gz: 4de5760e6741b97174761db24d5a35516663c0742cf098a4b7e88ea15f1febc2343671de21c976a82a1ae854a760dbc08c329974c4ee094eb57d8b308f0264ca
data/README.md CHANGED
@@ -70,6 +70,16 @@ if (confirm)
70
70
  end
71
71
  ```
72
72
 
73
+ ### Multiple Orders
74
+ Multiple orders can be submitted in a single request using the OrderEntry object
75
+ ```ruby
76
+ entry = Whitehouse::OrderEntry.new
77
+ entry.entry_id = '123abc'
78
+ entry.orders << order
79
+
80
+ confirm = Whitehouse.submit_order(entry)
81
+ ```
82
+
73
83
  ### Creating Webhooks
74
84
  ```ruby
75
85
  Whitehouse.create_webhook('http://example.com/webhook')
@@ -57,20 +57,24 @@ module Whitehouse
57
57
  def to_json
58
58
  {"EntryID" => entry_id,
59
59
  "Orders" => [
60
- {"DropShipFlag" => drop_ship,
61
- "FromAddressValue" => from_address_value,
62
- "OrderAttributes" => order_attributes,
63
- # "Reference" => reference,
64
- # "Instructions" => instructions,
65
- "SequenceNumber" => sequence_number,
66
- "ShipToAddress" => to_address,
67
- # "ShipFromAddress" => from_address,
68
- "OrderItems" => order_items
69
- }
70
- ]
60
+ order_hash
61
+ ]
71
62
  }.to_json
72
63
  end
73
64
 
65
+ def order_hash
66
+ {"DropShipFlag" => drop_ship,
67
+ "FromAddressValue" => from_address_value,
68
+ "OrderAttributes" => order_attributes,
69
+ # "Reference" => reference,
70
+ # "Instructions" => instructions,
71
+ "SequenceNumber" => sequence_number,
72
+ "ShipToAddress" => to_address,
73
+ # "ShipFromAddress" => from_address,
74
+ "OrderItems" => order_items
75
+ }
76
+ end
77
+
74
78
  private
75
79
 
76
80
  def defaults
@@ -0,0 +1,21 @@
1
+ require 'json'
2
+
3
+ module Whitehouse
4
+ class OrderEntry
5
+
6
+ attr_accessor :entry_id
7
+ attr_reader :orders
8
+
9
+ def initialize
10
+ @orders = []
11
+ yield self if block_given?
12
+ end
13
+
14
+ def to_json
15
+ {"EntryID" => entry_id,
16
+ "Orders" => orders.map(&:order_hash)
17
+ }.to_json
18
+ end
19
+
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module Whitehouse
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/whitehouse.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "whitehouse/client"
2
2
  require "whitehouse/default"
3
3
  require "whitehouse/order"
4
+ require "whitehouse/order_entry"
4
5
 
5
6
  # Ruby toolkit for the WHCC API
6
7
  module Whitehouse
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whitehouse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - travisdahlke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-10 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -188,6 +188,7 @@ files:
188
188
  - lib/whitehouse/default.rb
189
189
  - lib/whitehouse/error.rb
190
190
  - lib/whitehouse/order.rb
191
+ - lib/whitehouse/order_entry.rb
191
192
  - lib/whitehouse/version.rb
192
193
  - spec/cassettes/catalog.yml
193
194
  - spec/cassettes/client.yml
@@ -220,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
221
  version: '0'
221
222
  requirements: []
222
223
  rubyforge_project:
223
- rubygems_version: 2.4.1
224
+ rubygems_version: 2.2.2
224
225
  signing_key:
225
226
  specification_version: 4
226
227
  summary: White House Custom Colour API Client