class Centra::Order

Attributes

email[R]

Public Class Methods

new(data) click to toggle source
# File lib/centra/order.rb, line 5
def initialize(data)
  @email = data.delivery_email.strip.downcase
  @data = data
end

Public Instance Methods

captured_date() click to toggle source
# File lib/centra/order.rb, line 14
def captured_date
  @captured_date ||= Time.parse(@data.captured_date)
rescue ArgumentError => _e
end
delay_in_minutes(other) click to toggle source
# File lib/centra/order.rb, line 27
def delay_in_minutes(other)
  delay_in_seconds(other) / 60.0
end
delay_in_seconds(other) click to toggle source
# File lib/centra/order.rb, line 31
def delay_in_seconds(other)
  (order_date - other.order_date).abs
end
inspect() click to toggle source
# File lib/centra/order.rb, line 39
def inspect
  "#<Order:#{"0x00%x" % (object_id << 1)}(email: #{@email}, order_date: #{@order_date})"
end
method_missing(method, *args, &block) click to toggle source
# File lib/centra/order.rb, line 35
def method_missing(method, *args, &block)
  @data.public_send(method, *args, &block)
end
order_date() click to toggle source
# File lib/centra/order.rb, line 10
def order_date
  @order_date ||= Time.parse(@data.order_date)
end
pcs() click to toggle source
# File lib/centra/order.rb, line 19
def pcs
  @pcs ||= Integer(@data.pcs)
end
total_order_value_sek() click to toggle source
# File lib/centra/order.rb, line 23
def total_order_value_sek
  @total_order_value_sek ||= Float(@data.total_order_value_sek)
end