Class: Workarea::Orderbot::BogusGateway
- Inherits:
-
Object
- Object
- Workarea::Orderbot::BogusGateway
- Defined in:
- lib/workarea/orderbot/bogus_gateway.rb
Instance Method Summary collapse
- #create_order(attrs = {}) ⇒ Object
- #get_fulfillments(attrs = {}) ⇒ Object
- #get_inventory(attrs = {}) ⇒ Object
- #get_pricing(attrs = {}) ⇒ Object
- #get_products(attrs = {}) ⇒ Object
-
#initialize(options = {}) ⇒ BogusGateway
constructor
A new instance of BogusGateway.
Constructor Details
#initialize(options = {}) ⇒ BogusGateway
Returns a new instance of BogusGateway.
4 5 |
# File 'lib/workarea/orderbot/bogus_gateway.rb', line 4 def initialize( = {}) end |
Instance Method Details
#create_order(attrs = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/workarea/orderbot/bogus_gateway.rb', line 25 def create_order(attrs = {}) if attrs.first[:reference_order_id] == "error" Response.new(response(create_error_order_response, 400)) elsif attrs.first[:reference_order_id] == "failure" Response.new(response(create_order_save_failure_response, 200)) else Response.new(response(create_order_response)) end end |
#get_fulfillments(attrs = {}) ⇒ Object
35 36 37 |
# File 'lib/workarea/orderbot/bogus_gateway.rb', line 35 def get_fulfillments(attrs = {}) Response.new(response(get_fulfillments_response)) end |
#get_inventory(attrs = {}) ⇒ Object
17 18 19 |
# File 'lib/workarea/orderbot/bogus_gateway.rb', line 17 def get_inventory(attrs = {}) Response.new(response(get_inventory_response)) end |
#get_pricing(attrs = {}) ⇒ Object
21 22 23 |
# File 'lib/workarea/orderbot/bogus_gateway.rb', line 21 def get_pricing(attrs = {}) Response.new(response(get_pricing_response)) end |
#get_products(attrs = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/workarea/orderbot/bogus_gateway.rb', line 7 def get_products(attrs = {}) if attrs[:response_model] == 'CustomField' && attrs[:sku] == 'backordersku' Response.new(response(get_backordered_products_custom_field_response)) elsif attrs[:response_model] == 'CustomField' Response.new(response(get_products_custom_field_response)) else Response.new(response(get_products_response)) end end |