Class: BigcommerceAPI::OrderProduct

Inherits:
Resource show all
Defined in:
lib/bigcommerce_api/order_product.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#errors

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#assign_attributes, belongs_to, #changed, #delete, has_many, has_one, http_request, #initialize, #mark_dirty!, #reload, #resource, resource, #update_attributes

Methods inherited from Base

#attributes, clean!, date_adjust, default_options, #initialize, #store, #time, to_rfc2822

Constructor Details

This class inherits a constructor from BigcommerceAPI::Resource

Instance Attribute Details

#applied_discountsObject

Returns the value of attribute applied_discounts.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def applied_discounts
  @applied_discounts
end

#base_cost_priceObject

Returns the value of attribute base_cost_price.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def base_cost_price
  @base_cost_price
end

#base_priceObject

Returns the value of attribute base_price.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def base_price
  @base_price
end

#base_totalObject

Returns the value of attribute base_total.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def base_total
  @base_total
end

#base_wrapping_costObject

Returns the value of attribute base_wrapping_cost.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def base_wrapping_cost
  @base_wrapping_cost
end

#bin_picking_numberObject

Returns the value of attribute bin_picking_number.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def bin_picking_number
  @bin_picking_number
end

#configurable_fieldsObject

Returns the value of attribute configurable_fields.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def configurable_fields
  @configurable_fields
end

#cost_price_ex_taxObject

Returns the value of attribute cost_price_ex_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def cost_price_ex_tax
  @cost_price_ex_tax
end

#cost_price_inc_taxObject

Returns the value of attribute cost_price_inc_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def cost_price_inc_tax
  @cost_price_inc_tax
end

#cost_price_taxObject

Returns the value of attribute cost_price_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def cost_price_tax
  @cost_price_tax
end

#ebay_item_idObject

Returns the value of attribute ebay_item_id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def ebay_item_id
  @ebay_item_id
end

#ebay_transaction_idObject

Returns the value of attribute ebay_transaction_id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def ebay_transaction_id
  @ebay_transaction_id
end

#event_dateObject

Returns the value of attribute event_date.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def event_date
  @event_date
end

#event_nameObject

Returns the value of attribute event_name.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def event_name
  @event_name
end

#fixed_shipping_costObject

Returns the value of attribute fixed_shipping_cost.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def fixed_shipping_cost
  @fixed_shipping_cost
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def id
  @id
end

#is_bundled_productObject

Returns the value of attribute is_bundled_product.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def is_bundled_product
  @is_bundled_product
end

#is_refundedObject

Returns the value of attribute is_refunded.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def is_refunded
  @is_refunded
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def name
  @name
end

#option_set_idObject

Returns the value of attribute option_set_id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def option_set_id
  @option_set_id
end

#order_address_idObject

Returns the value of attribute order_address_id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def order_address_id
  @order_address_id
end

#order_idObject

Returns the value of attribute order_id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def order_id
  @order_id
end

#orderproduct_typeObject

reserved



56
57
58
# File 'lib/bigcommerce_api/order_product.rb', line 56

def orderproduct_type
  @orderproduct_type
end

#parent_order_product_idObject

Returns the value of attribute parent_order_product_id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def parent_order_product_id
  @parent_order_product_id
end

#price_ex_taxObject

Returns the value of attribute price_ex_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def price_ex_tax
  @price_ex_tax
end

#price_inc_taxObject

Returns the value of attribute price_inc_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def price_inc_tax
  @price_inc_tax
end

#price_taxObject

Returns the value of attribute price_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def price_tax
  @price_tax
end

#product_idObject

Returns the value of attribute product_id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def product_id
  @product_id
end

#product_optionsObject

Returns the value of attribute product_options.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def product_options
  @product_options
end

#quantityObject

Returns the value of attribute quantity.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def quantity
  @quantity
end

#quantity_shippedObject

Returns the value of attribute quantity_shipped.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def quantity_shipped
  @quantity_shipped
end

#refund_amountObject

Returns the value of attribute refund_amount.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def refund_amount
  @refund_amount
end

#return_idObject

Returns the value of attribute return_id.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def return_id
  @return_id
end

#skuObject

Returns the value of attribute sku.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def sku
  @sku
end

#total_ex_taxObject

Returns the value of attribute total_ex_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def total_ex_tax
  @total_ex_tax
end

#total_inc_taxObject

Returns the value of attribute total_inc_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def total_inc_tax
  @total_inc_tax
end

#total_taxObject

Returns the value of attribute total_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def total_tax
  @total_tax
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def type
  @type
end

#weightObject

Returns the value of attribute weight.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def weight
  @weight
end

#wrapping_cost_ex_taxObject

Returns the value of attribute wrapping_cost_ex_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def wrapping_cost_ex_tax
  @wrapping_cost_ex_tax
end

#wrapping_cost_inc_taxObject

Returns the value of attribute wrapping_cost_inc_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def wrapping_cost_inc_tax
  @wrapping_cost_inc_tax
end

#wrapping_cost_taxObject

Returns the value of attribute wrapping_cost_tax.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def wrapping_cost_tax
  @wrapping_cost_tax
end

#wrapping_messageObject

Returns the value of attribute wrapping_message.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def wrapping_message
  @wrapping_message
end

#wrapping_nameObject

Returns the value of attribute wrapping_name.



3
4
5
# File 'lib/bigcommerce_api/order_product.rb', line 3

def wrapping_name
  @wrapping_name
end

Class Method Details

.all(order_id, params = {}) ⇒ Object



88
89
90
91
# File 'lib/bigcommerce_api/order_product.rb', line 88

def all(order_id, params={})
  resources = BigcommerceAPI::Base.get("/orders/#{order_id}/products", query: date_adjust(params))
  (resources.success? and !resources.nil?) ? resources.collect{|r| self.new(r)} : []
end

.find(order_id, id) ⇒ Object



93
94
95
96
# File 'lib/bigcommerce_api/order_product.rb', line 93

def find(order_id, id)
  r = BigcommerceAPI::Base.get("/orders/#{order_id}/products/#{id}")
  (r.success? and !r.nil?) ? self.new(r) : nil
end

Instance Method Details

#create(params = {}) ⇒ Object



69
70
71
72
# File 'lib/bigcommerce_api/order_product.rb', line 69

def create(params={})
	self.errors = ["Shipping Addresses are readonly"]
	return false
end

#find_for_reloadObject



83
84
85
# File 'lib/bigcommerce_api/order_product.rb', line 83

def find_for_reload
  self.class.find(self.order_id, self.id)
end

#parentObject



79
80
81
# File 'lib/bigcommerce_api/order_product.rb', line 79

def parent
  'order'
end

#resource_urlObject

this overrides the default method, since this has to come in with an order id



75
76
77
# File 'lib/bigcommerce_api/order_product.rb', line 75

def resource_url
  "orders/#{self.order_id}/products"
end

#saveObject

TODO: these can probably go in a ReadOnly class



64
65
66
67
# File 'lib/bigcommerce_api/order_product.rb', line 64

def save
	self.errors = ["Shipping Addresses are readonly"]
	return false
end

#shipping_addressObject



58
59
60
61
# File 'lib/bigcommerce_api/order_product.rb', line 58

def shipping_address
  a = BigcommerceAPI::Base.get "/orders/#{self.order_id}/shipping_addresses/#{self.order_address_id}"
  (a.success? and !a.nil?) ? BigcommerceAPI::Shippingaddress.new(a) : nil
end