Class: Workarea::Yotpo::Order
- Inherits:
-
Object
- Object
- Workarea::Yotpo::Order
- Defined in:
- app/services/yotpo/order.rb
Defined Under Namespace
Modules: ProductImageUrl, ProductUrl
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#order_id ⇒ Object
readonly
Returns the value of attribute order_id.
Instance Method Summary collapse
-
#initialize(order_id, options = {}) ⇒ Order
constructor
A new instance of Order.
-
#to_h ⇒ Hash
Builds an order hash for Yotpo API consumption.
Constructor Details
#initialize(order_id, options = {}) ⇒ Order
Returns a new instance of Order.
24 25 26 27 |
# File 'app/services/yotpo/order.rb', line 24 def initialize(order_id, = {}) @order_id = order_id @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
22 23 24 |
# File 'app/services/yotpo/order.rb', line 22 def @options end |
#order_id ⇒ Object (readonly)
Returns the value of attribute order_id.
22 23 24 |
# File 'app/services/yotpo/order.rb', line 22 def order_id @order_id end |
Instance Method Details
#to_h ⇒ Hash
Builds an order hash for Yotpo API consumption
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/services/yotpo/order.rb', line 33 def to_h { validate_data: true, platform: "general", # TODO - get on the list of approved yotpo platforms email: order.email, customer_name: order.billing_address.first_name + " " + order.billing_address.last_name, order_id: order.id, order_date: order.placed_at, currency_iso: order.total_price.currency.iso_code, products: products, customer: customer } end |