Class: OrderAddress
- Inherits:
-
Object
- Object
- OrderAddress
- Defined in:
- lib/order_address.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
Instance Method Summary collapse
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
3 4 5 |
# File 'lib/order_address.rb', line 3 def address @address end |
Instance Method Details
#input ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/order_address.rb', line 5 def input response = Request.get("https://order.dominos.jp/eng/receipt/", expect: :ok, failure: "Couldn't get order types page") addresses = Addresses.from(response.body) index = Ask.list "Choose an address", addresses.selection_list self.address = addresses[index] end |
#validate ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/order_address.rb', line 14 def validate raise "Missing attributes" unless address # Get the default parameters and add in the delivery address params = default_params.merge("todokeSeq" => address.id) Request.post("https://order.dominos.jp/eng/receipt/setReceipt", params, expect: :redirect, to: "https://order.dominos.jp/eng/receipt/input/", failure: "Couldn't set the delivery address") end |