Class: BooticCli::Commands::Orders
- Inherits:
-
BooticCli::Command
- Object
- Thor
- BooticCli::Command
- BooticCli::Commands::Orders
- Defined in:
- lib/bootic_cli/commands/orders.rb
Defined Under Namespace
Classes: OrdersTable
Constant Summary collapse
- MAPPERS =
{ 'table' => OrdersTable, 'csv' => OrdersTable, 'json' => ->(orders) { orders.to_hash } }
Constants included from BooticCli::Connectivity
BooticCli::Connectivity::DEFAULT_ENV
Instance Method Summary collapse
Methods inherited from BooticCli::Command
Instance Method Details
#list ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/bootic_cli/commands/orders.rb', line 58 def list logged_in_action do opts = {} opts[:status] = ['s'] if ['s'] opts[:q] = ['q'] if ['q'] opts[:sort] = ['so'] if ['so'] opts[:updated_on_gte] = ['ugte'] if ['ugte'] opts[:updated_on_lte] = ['ulte'] if ['ugte'] opts[:total_gte] = ['tgte'] if ['tgte'] opts[:total_lte] = ['tlte'] if ['tlte'] opts[:discount_total_gte] = ['dgte'] if ['dgte'] opts[:discount_total_lte] = ['dlte'] if ['dlte'] opts[:code] = ['c'] if ['c'] orders = shop.orders(opts) orders = orders.full_set if [:a] puts Formatters.format(['o'], MAPPERS[['o']].call(orders)) end end |