class Levelup::Requests::CreateOrder
Represents a request to create an order for the specified user at the specified merchant.
Attributes
identifier_from_merchant[RW]
A merchant-supplied unique ID for this order. Optional.
items[RW]
An array of Item objects (or hashes representing them) representing all items purchased by this order.
location_id[RW]
The LevelUp ID for the location from which this order was requested.
spend_amount[RW]
The total amount (in cents) spent on this order.
Public Instance Methods
body()
click to toggle source
# File lib/levelup/requests/create_order.rb, line 16 def body items = (@items || []).map do |item| if item.empty? next end { item: item } end order_hash = to_hash order_hash[:items] = items { order: order_hash } end
response_from_hash(hash)
click to toggle source
# File lib/levelup/requests/create_order.rb, line 31 def response_from_hash(hash) Responses::Success.new(hash['order']) end