class Kitely::Order
Attributes
customer[RW]
jobs[RW]
Public Class Methods
new(customer:) { |jobs| ... }
click to toggle source
# File lib/kitely/order.rb, line 7 def initialize(customer:) self.customer = customer self.jobs = [] yield jobs if block_given? end
Public Instance Methods
add(job)
click to toggle source
# File lib/kitely/order.rb, line 13 def add(job) self.jobs.push(job) end
attributes()
click to toggle source
# File lib/kitely/order.rb, line 17 def attributes { shipping_address: self.customer.shipping_address, customer_phone: self.customer.phone, customer_email: self.customer.email, jobs: self.jobs.map(&:attributes) } end
http()
click to toggle source
# File lib/kitely/order.rb, line 30 def http @http ||= HTTP.auth("ApiKey #{Kitely.public_key}:#{Kitely.secret_key}") end
order!()
click to toggle source
# File lib/kitely/order.rb, line 26 def order! self.http.post(Kitely.url('print'), json: self.attributes) end