Class: DominosJP
- Inherits:
-
Object
- Object
- DominosJP
- Defined in:
- lib/version.rb,
lib/dominosjp.rb
Constant Summary collapse
- VERSION =
"0.2.0".freeze
Instance Attribute Summary collapse
-
#order_address ⇒ Object
Returns the value of attribute order_address.
-
#order_coupon ⇒ Object
Returns the value of attribute order_coupon.
-
#order_information ⇒ Object
Returns the value of attribute order_information.
-
#order_payment ⇒ Object
Returns the value of attribute order_payment.
-
#order_review ⇒ Object
Returns the value of attribute order_review.
Instance Method Summary collapse
-
#initialize(login_details = {}) ⇒ DominosJP
constructor
A new instance of DominosJP.
- #login ⇒ Object
- #order ⇒ Object
Constructor Details
#initialize(login_details = {}) ⇒ DominosJP
Returns a new instance of DominosJP.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dominosjp.rb', line 24 def initialize(login_details = {}) @email = login_details[:email] || Preferences.instance.email @password = login_details[:password] self.order_address = OrderAddress.new self.order_information = OrderInformation.new self.order_review = OrderReview.new self.order_coupon = OrderCoupon.new self.order_payment = OrderPayment.new end |
Instance Attribute Details
#order_address ⇒ Object
Returns the value of attribute order_address.
20 21 22 |
# File 'lib/dominosjp.rb', line 20 def order_address @order_address end |
#order_coupon ⇒ Object
Returns the value of attribute order_coupon.
22 23 24 |
# File 'lib/dominosjp.rb', line 22 def order_coupon @order_coupon end |
#order_information ⇒ Object
Returns the value of attribute order_information.
20 21 22 |
# File 'lib/dominosjp.rb', line 20 def order_information @order_information end |
#order_payment ⇒ Object
Returns the value of attribute order_payment.
22 23 24 |
# File 'lib/dominosjp.rb', line 22 def order_payment @order_payment end |
#order_review ⇒ Object
Returns the value of attribute order_review.
21 22 23 |
# File 'lib/dominosjp.rb', line 21 def order_review @order_review end |
Instance Method Details
#login ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dominosjp.rb', line 35 def login @email ||= Ask.input("Email") @password ||= HighLine.new.ask("Password: ") { |q| q.echo = "*" } Request.post( "https://order.dominos.jp/eng/login/login/", { "emailAccount" => @email, "webPwd" => @password }, expect: :redirect, failure: "Couldn't log in successfully" ) end |
#order ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/dominosjp.rb', line 46 def order order_address.input order_address.validate order_information.input order_information.validate order_information.display order_information.confirm PizzaSelector.select_pizzas SideSelector.select_sides order_review.display order_coupon.total_price_without_tax = order_review.total_price_without_tax order_coupon.input order_coupon.validate order_review.display order_payment.default_name = order_information.name order_payment.input order_payment.validate order_payment.display order_review.page = order_payment.page order_review.display order_payment.confirm end |