Class: Workarea::GlobalE::Api::RemoveRestrictedProducts
- Inherits:
-
Object
- Object
- Workarea::GlobalE::Api::RemoveRestrictedProducts
- Defined in:
- app/services/workarea/global_e/api/remove_restricted_products.rb
Instance Attribute Summary collapse
-
#codes ⇒ Object
readonly
Returns the value of attribute codes.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(order, codes = []) ⇒ RemoveRestrictedProducts
constructor
A new instance of RemoveRestrictedProducts.
- #response ⇒ Object
Constructor Details
#initialize(order, codes = []) ⇒ RemoveRestrictedProducts
Returns a new instance of RemoveRestrictedProducts.
7 8 9 10 |
# File 'app/services/workarea/global_e/api/remove_restricted_products.rb', line 7 def initialize(order, codes = []) @order = order @codes = codes end |
Instance Attribute Details
#codes ⇒ Object (readonly)
Returns the value of attribute codes.
5 6 7 |
# File 'app/services/workarea/global_e/api/remove_restricted_products.rb', line 5 def codes @codes end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
5 6 7 |
# File 'app/services/workarea/global_e/api/remove_restricted_products.rb', line 5 def order @order end |
Class Method Details
.perform(*args) ⇒ Object
12 13 14 |
# File 'app/services/workarea/global_e/api/remove_restricted_products.rb', line 12 def self.perform(*args) new(*args).tap(&:call) end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 |
# File 'app/services/workarea/global_e/api/remove_restricted_products.rb', line 16 def call order.items.each do |item| item.destroy if item.sku.in?(codes) end end |
#response ⇒ Object
22 23 24 |
# File 'app/services/workarea/global_e/api/remove_restricted_products.rb', line 22 def response @response ||= Merchant::ResponseInfo.new(order: order) end |