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 +4 -4
- data/README.md +10 -0
- data/lib/whitehouse/order.rb +15 -11
- data/lib/whitehouse/order_entry.rb +21 -0
- data/lib/whitehouse/version.rb +1 -1
- data/lib/whitehouse.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a83e40583b0966e208d5be28e9cca2512830625
|
4
|
+
data.tar.gz: e3c9fbf7bf3d06264bf924c9c6b6426aa0594d56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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')
|
data/lib/whitehouse/order.rb
CHANGED
@@ -57,20 +57,24 @@ module Whitehouse
|
|
57
57
|
def to_json
|
58
58
|
{"EntryID" => entry_id,
|
59
59
|
"Orders" => [
|
60
|
-
|
61
|
-
|
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
|
data/lib/whitehouse/version.rb
CHANGED
data/lib/whitehouse.rb
CHANGED
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
|
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:
|
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.
|
224
|
+
rubygems_version: 2.2.2
|
224
225
|
signing_key:
|
225
226
|
specification_version: 4
|
226
227
|
summary: White House Custom Colour API Client
|