class FastSpring::Order

Public Instance Methods

address() click to toggle source
# File lib/fastspring-saasy/order.rb, line 68
def address
  @address ||= Address.new(value_for('address'))
end
base_order_path() click to toggle source
# File lib/fastspring-saasy/order.rb, line 13
def base_order_path
  "/company/#{@company}/order/#{@reference}"
end
build_from(response) click to toggle source
# File lib/fastspring-saasy/order.rb, line 9
def build_from(response)
  @response = response
end
currency() click to toggle source
# File lib/fastspring-saasy/order.rb, line 44
def currency
  value_for('currency')
end
due() click to toggle source

Returns a DateTime object

# File lib/fastspring-saasy/order.rb, line 40
def due
  DateTime.parse(value_for('due'))
end
find() click to toggle source

Get the order from Saasy

# File lib/fastspring-saasy/order.rb, line 4
def find
  @response = self.class.get(base_order_path, :basic_auth => @auth, :ssl_ca_file => @ssl_ca_file)
  self
end
items() click to toggle source
# File lib/fastspring-saasy/order.rb, line 17
def items
  @items ||= [Item.new(parsed_response['orderItems']['orderItem'])]
end
origin_ip() click to toggle source
# File lib/fastspring-saasy/order.rb, line 48
def origin_ip
  value_for('originIp')
end
payment() click to toggle source
# File lib/fastspring-saasy/order.rb, line 25
def payment
  payments[0]
end
payments() click to toggle source
# File lib/fastspring-saasy/order.rb, line 21
def payments
  @payments ||= [Payment.new(parsed_response['payments']['payment'])]
end
purchaser() click to toggle source
# File lib/fastspring-saasy/order.rb, line 52
def purchaser
  @purchaser ||= Customer.new(value_for('customer'))
end
reference() click to toggle source

Return the order reference

# File lib/fastspring-saasy/order.rb, line 30
def reference
  value_for('reference')
end
shipping() click to toggle source
# File lib/fastspring-saasy/order.rb, line 64
def shipping
  value_for('shipping').to_f
end
tax() click to toggle source
# File lib/fastspring-saasy/order.rb, line 60
def tax
  value_for('tax').to_f
end
test?() click to toggle source

Was the order a test?

# File lib/fastspring-saasy/order.rb, line 35
def test?
  value_for('test') == 'true'
end
total() click to toggle source
# File lib/fastspring-saasy/order.rb, line 56
def total
  value_for('total').to_f
end

Private Instance Methods

parsed_response() click to toggle source
# File lib/fastspring-saasy/order.rb, line 74
def parsed_response
  @response.parsed_response['order']
end