Class: BooticCli::Commands::Orders::OrdersTable

Inherits:
Object
  • Object
show all
Defined in:
lib/bootic_cli/commands/orders.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(orders) ⇒ OrdersTable

Returns a new instance of OrdersTable.



9
10
11
# File 'lib/bootic_cli/commands/orders.rb', line 9

def initialize(orders)
  @orders = orders
end

Class Method Details

.call(orders) ⇒ Object



5
6
7
# File 'lib/bootic_cli/commands/orders.rb', line 5

def self.call(orders)
  new(orders).data
end

Instance Method Details

#dataObject



13
14
15
16
17
18
19
# File 'lib/bootic_cli/commands/orders.rb', line 13

def data
  data = [['status', 'updated', 'created', 'code', 'total', 'discount', 'payment', 'client']]
  data += orders.map do |order|
    [order.status, order.updated_on, order.created_on, order.code, order.total, discount_line(order), payment_line(order), order_contact_name(order)]
  end
  data
end