class Oshpark::Order
Constants
- STATES
Public Class Methods
attrs()
click to toggle source
# File lib/oshpark/order.rb, line 6 def self.attrs %w| id board_cost cancellation_reason cancelled_at ordered_at payment_provider payment_received_at project_name quantity shipping_address shipping_cost shipping_country shipping_method shipping_name state total_cost project_id panel_id coupon_rebate address shipping_rate order_items | end
create()
click to toggle source
# File lib/oshpark/order.rb, line 18 def self.create self.from_json(Oshpark::client.create_order['order']) end
Public Instance Methods
add_item(order_item, quantity)
click to toggle source
# File lib/oshpark/order.rb, line 22 def add_item order_item, quantity reload_with Oshpark::client.add_order_item id, order_item.id, quantity end
address()
click to toggle source
# File lib/oshpark/order.rb, line 62 def address Oshpark::Address.from_json @address if @address end
cancel()
click to toggle source
# File lib/oshpark/order.rb, line 38 def cancel reload_with Oshpark.client.cancel_order id end
cancelled_at()
click to toggle source
# File lib/oshpark/order.rb, line 50 def cancelled_at time_from @cancelled_at end
checkout()
click to toggle source
# File lib/oshpark/order.rb, line 34 def checkout reload_with Oshpark.client.checkout_order id end
order_items()
click to toggle source
# File lib/oshpark/order.rb, line 70 def order_items Array(@order_items).map do |order_item| Oshpark::OrderItem.from_json order_item end end
ordered_at()
click to toggle source
# File lib/oshpark/order.rb, line 54 def ordered_at time_from @ordered_at end
panel()
click to toggle source
# File lib/oshpark/order.rb, line 42 def panel Panel.find panel_id end
payment_received_at()
click to toggle source
# File lib/oshpark/order.rb, line 58 def payment_received_at time_from @payment_received_at end
project()
click to toggle source
# File lib/oshpark/order.rb, line 46 def project Project.find project_id end
set_address(address)
click to toggle source
# File lib/oshpark/order.rb, line 26 def set_address address reload_with Oshpark::client.set_order_address id, address end
set_shipping_rate(shipping_rate)
click to toggle source
# File lib/oshpark/order.rb, line 30 def set_shipping_rate shipping_rate reload_with Oshpark::client.set_order_shipping_rate id, shipping_rate end
shipping_rate()
click to toggle source
# File lib/oshpark/order.rb, line 66 def shipping_rate Oshpark::ShippingRate.from_json @shipping_rate if @shipping_rate end