class DellinInfo::API::OrderCollection
Attributes
cash[R]
errors[R]
orders[R]
Public Class Methods
new(orders_hash)
click to toggle source
# File lib/dellininfo/order_collection.rb, line 21 def initialize(orders_hash) @errors = orders_hash['errormsg'] @orders = [] @cash = orders_hash.dig('orders', 'tracker') unless orders_hash['orders'].blank? unless @cash.nil? @cash.each do |track| @orders << Order.new(track) end end determine_state! end
Public Instance Methods
each() { |oder| ... }
click to toggle source
# File lib/dellininfo/order_collection.rb, line 13 def each @orders.each {|oder| yield oder} end
Private Instance Methods
determine_state!()
click to toggle source
# File lib/dellininfo/order_collection.rb, line 36 def determine_state! @orders.each do |order| id_oder = order.docNumber status = DellinInfo::API.status_oder(id_oder) order.state = status.state order.city_sender = status.receive['city'] order.city_receiver = status.giveout['city'] end self end