finerworks 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ba637f8dae31b5c41546a331d7cc046bd50e3fc
4
- data.tar.gz: d785cff89b74be3121fec4fe8aa358ead878966a
3
+ metadata.gz: 77105142ccb403a4a0b6733f5ca9c5ae68654a05
4
+ data.tar.gz: 4b8928f2062635b29662ce43c0ddcbbba1336c67
5
5
  SHA512:
6
- metadata.gz: 088365b075195dffef0939c953d0aae066ad18270cea3080ba4fe94332b2839282737a46b00f0099d4a7138872778feec20d32efc46309ed570a1ba62119398e
7
- data.tar.gz: 15c67e8d1ea13b60d493503af9d474f729a0ff89f81c178b29740ec4d62bfb1d26f8482ae41dd45c0f868a6191a5d5e2cc2b205418c701aee3044b95618f83a1
6
+ metadata.gz: c98c85c7c3c2dc80a101e5458038eac72db42e3ebb8240b17af7334ae1803b5144c856bd87b88a34c03cfd8e2a5c1d7e1dbbec39434f2d0840188447a65159c4
7
+ data.tar.gz: 523d013eb10b6ef4f3b22ff39173031cf8b562d8141dbd28dafa7aa1be0c0ea5457df33ea10c2341ad627f9bcc079c4f5a61f2528e8abe4063fc9a9c4e48db7c
@@ -5,6 +5,7 @@ require 'finerworks/print'
5
5
  require 'finerworks/gallery'
6
6
  require 'finerworks/image'
7
7
  require 'finerworks/order'
8
+ require 'finerworks/order_details'
8
9
 
9
10
  module FinerWorks
10
11
  class Client
@@ -65,6 +66,14 @@ module FinerWorks
65
66
  get(FinerWorks::Order, "/Orders", options)
66
67
  end
67
68
 
69
+ # Provides order details.
70
+ #
71
+ # ==== Parameters:
72
+ # [id] Order ID number.
73
+ def order_details(id)
74
+ get(FinerWorks::OrderDetails, "/OrderDetails", { "OrderID" => id })
75
+ end
76
+
68
77
  # Generic GET method to request items of the specified +type+. This always returns an +Array+.
69
78
  def get(type, path, options = {})
70
79
  response = FinerWorks::Request.get(self, path, options)
@@ -8,5 +8,7 @@ module FinerWorks
8
8
  property :drop_ship, from: "OrderDropShip"
9
9
  property :status_id, from: "OrderStatusID"
10
10
  property :status_label, from: "OrderStatusLabel"
11
+
12
+ alias_method :drop_ship?, :drop_ship
11
13
  end
12
14
  end
@@ -0,0 +1,78 @@
1
+ module FinerWorks
2
+ class OrderDetails < Hashie::Trash
3
+ property :id, from: "OrderID"
4
+ property :status_label, from: "OrderStatusLabel"
5
+ property :cart_id, from: "OrderCartID"
6
+ property :shipping_option_method, from: "ShippingOptionMethod"
7
+ property :customer_guid, from: "OrderCustomerGUID"
8
+ property :shipping_code, from: "OrderShippingCode"
9
+ property :shipping_id, from: "OrderShippingID"
10
+ property :status_id, from: "OrderStatusID"
11
+ property :sub_total, from: "OrderSubTotal"
12
+ property :sales_tax, from: "OrderSalesTax"
13
+ property :discount, from: "OrderDiscount"
14
+ property :shipping, from: "OrderShipping"
15
+ property :credits_used, from: "OrderCreditsUsed"
16
+ property :grand_total, from: "OrderGrandTotal"
17
+ property :date_time, from: "OrderDateTime", transform_with: lambda { |d| Time.parse(d) }
18
+ property :drop_ship, from: "OrderDropShip", transform_with: lambda { |value| value == "True" }
19
+ property :shipping_instructions, from: "OrderShippingInstructions"
20
+ property :payment_method_name, from: "PaymentMethodName"
21
+ property :customer_details, from: "CustomerDetails", with: lambda { |d| CustomerDetails.new(d) }
22
+ property :order_items, from: "OrderItems", with: lambda { |items| items.map { |i| OrderItem.new(i) } }
23
+
24
+ alias_method :drop_ship?, :drop_ship
25
+ end
26
+
27
+ class CustomerDetails < Hashie::Trash
28
+ property :customer_id, from: "CustomerID"
29
+ property :customer_guid, from: "CustomerGUID"
30
+ property :customer_billing_details, from: "CustomerBillingDetails", with: lambda { |d| CustomerBillingDetails.new(d) }
31
+ property :customer_shipping_details, from: "CustomerShippingDetails", with: lambda { |d| CustomerShippingDetails.new(d) }
32
+ property :customer_payment_details, from: "CustomerPaymentDetails"
33
+ end
34
+
35
+ class CustomerBillingDetails < Hashie::Trash
36
+ property :first_name, from: "CustomerBillFirstName"
37
+ property :middle_name, from: "CustomerBillMiddleName"
38
+ property :last_name, from: "CustomerBillLastName"
39
+ property :company, from: "CustomerBillCompany"
40
+ property :address1, from: "CustomerBillAddress1"
41
+ property :address2, from: "CustomerBillAddress2"
42
+ property :city, from: "CustomerBillCity"
43
+ property :state, from: "CustomerBillState"
44
+ property :zip, from: "CustomerBillZip"
45
+ property :state_other, from: "CustomerBillStateOther"
46
+ property :country, from: "CustomerBillCountry"
47
+ property :phone, from: "CustomerBillPhone"
48
+ property :email, from: "CustomerBillEmail"
49
+ end
50
+
51
+ class CustomerShippingDetails < Hashie::Trash
52
+ property :ship_is_bill, from: "CustomerShipIsBill"
53
+ property :first_name, from: "CustomerShipFirstName"
54
+ property :middle_name, from: "CustomerShipMiddleName"
55
+ property :last_name, from: "CustomerShipLastName"
56
+ property :company, from: "CustomerShipCompany"
57
+ property :address1, from: "CustomerShipAddress1"
58
+ property :address2, from: "CustomerShipAddress2"
59
+ property :city, from: "CustomerShipCity"
60
+ property :state, from: "CustomerShipState"
61
+ property :zip, from: "CustomerShipZip"
62
+ property :state_other, from: "CustomerShipStateOther"
63
+ property :country, from: "CustomerShipCountry"
64
+ property :phone, from: "CustomerShipPhone"
65
+ end
66
+
67
+ class OrderItem < Hashie::Trash
68
+ property :print_product_id, from: "PrintProductID"
69
+ property :print_product_print_guid, from: "PrintProductPrintGUID"
70
+ property :print_product_title, from: "PrintProductTitle"
71
+ property :print_product_qty, from: "PrintProductQty"
72
+ property :print_product_price, from: "PrintProductPrice"
73
+ property :print_product_type_id, from: "PrintProductTypeID"
74
+ property :print_product_name, from: "PrintProductName"
75
+ property :static_product_name, from: "StaticProductName"
76
+ property :static_product_id, from: "StaticProductID"
77
+ end
78
+ end
@@ -8,7 +8,7 @@ module FinerWorks
8
8
  @code = http_response.code
9
9
  @message = http_response.message
10
10
  @body = http_response.body
11
- @json = JSON.parse(@body)
11
+ @json = JSON.parse(@body) if http_response.is_a? Net::HTTPOK
12
12
  end
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finerworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Fredrickson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-20 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -94,6 +94,7 @@ files:
94
94
  - lib/finerworks/gallery.rb
95
95
  - lib/finerworks/image.rb
96
96
  - lib/finerworks/order.rb
97
+ - lib/finerworks/order_details.rb
97
98
  - lib/finerworks/print.rb
98
99
  - lib/finerworks/request.rb
99
100
  - lib/finerworks/response.rb