tiramizoo 0.1.0 → 0.1.2

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: 9157ca4c1d365036ac30a2b0dc95077d13defeb0
4
- data.tar.gz: 3b4cd7cf47b68d57206d79df7a583cd986247333
3
+ metadata.gz: 9753a887d75f034b1fdb4ef4e98b4c21e936300f
4
+ data.tar.gz: d612e145a37743a2625d9eb8fe01d4c80f82ca8e
5
5
  SHA512:
6
- metadata.gz: a21b212557ba254f16d0709fb89208f514f1fe8ad77a8071383d9aeffb74ebaf45631189cd42a9f9f20835d0041875069fa984ffbbb9f49c50d3652b1d7f60c0
7
- data.tar.gz: edee73d6b676148210fcca12d4ac6aa0bd12a8782c02aeee146541f1f806e4c5b18f66acb66784976676750723df2afd16e6737302572cf42354a5540b2d0997
6
+ metadata.gz: 467312aec377ba5f3c0ccbafb79fc43e554e7f8f76eccb649697a289d1ecc729a45580f73325a687a72a48160cb71118bab3b3e4d0d4c5395ff2e766b17ab7c0
7
+ data.tar.gz: e29cc9d274fef01babae1ccc220ce2bac04b2d3ac3aeb4fde56f1f306b26ce7ac3bb4aa24bfc4c88d41fa125704350481203091d493da43ef7aa31acbbba64bf
data/lib/tiramizoo.rb CHANGED
@@ -20,24 +20,35 @@ module Tiramizoo
20
20
  sender = sender.slice("address_line", "postal_code", "country_code", "name", "phone_number", "information")
21
21
  recipient = recipient.slice("address_line", "postal_code", "country_code", "name", "phone_number", "information")
22
22
 
23
+ body = {
24
+ "pickup" => sender.merge({
25
+ "after" => time_window["pickup_after"]
26
+ }),
27
+ "delivery" => recipient.merge({
28
+ "after" => time_window["delivery_after"],
29
+ "before" => time_window["delivery_before"]
30
+ }),
31
+ "packages" => packages.map do |p|
32
+ p.slice("width", "height", "length", "description", "quantity")
33
+ end
34
+ }
35
+
36
+ if options["external_id"].present?
37
+ body["external_id"] = options["external_id"]
38
+ end
39
+
40
+ if options["web_hook_url"].present?
41
+ body["web_hook_url"] = options["web_hook_url"]
42
+ end
43
+
44
+ if options["recipient_email"].present?
45
+ body["recipient_email"] = options["recipient_email"]
46
+ end
47
+
23
48
  response = connection.post({
24
49
  :path => "/api/v1/orders",
25
50
  :headers => {"Api-Token" => api_token, "Content-Type" => "application/json"},
26
- :body => {
27
- "pickup" => sender.merge({
28
- "after" => time_window["pickup_after"]
29
- }),
30
- "delivery" => recipient.merge({
31
- "after" => time_window["delivery_after"],
32
- "before" => time_window["delivery_before"]
33
- }),
34
- "packages" => packages.map do |p|
35
- p.slice("width", "height", "length", "description", "quantity")
36
- end,
37
- "external_id" => options["external_id"],
38
- "web_hook_url" => options["web_hook_url"],
39
- "recipient_email" => options["recipient_email"]
40
- }.to_json
51
+ :body => body.to_json
41
52
  })
42
53
 
43
54
  case response.status
@@ -1,3 +1,3 @@
1
1
  module Tiramizoo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiramizoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiramizoo