Class: Mollie::Order::Line

Inherits:
Base
  • Object
show all
Defined in:
lib/mollie/order/line.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, #assign_attributes, cancel, create, #delete, delete, get, id_param, #initialize, parent_id, request, resource_name, #update

Constructor Details

This class inherits a constructor from Mollie::Base

Instance Attribute Details

Returns the value of attribute _links.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def _links
  @_links
end

#amount_canceledObject

Returns the value of attribute amount_canceled.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def amount_canceled
  @amount_canceled
end

#amount_refundedObject

Returns the value of attribute amount_refunded.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def amount_refunded
  @amount_refunded
end

#amount_shippedObject

Returns the value of attribute amount_shipped.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def amount_shipped
  @amount_shipped
end

#cancelable_quantityObject

Returns the value of attribute cancelable_quantity.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def cancelable_quantity
  @cancelable_quantity
end

#created_atObject

Returns the value of attribute created_at.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def created_at
  @created_at
end

#discount_amountObject

Returns the value of attribute discount_amount.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def discount_amount
  @discount_amount
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def id
  @id
end

#is_cancelableObject

Returns the value of attribute is_cancelable.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def is_cancelable
  @is_cancelable
end

#metadataObject

Returns the value of attribute metadata.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def 
  @metadata
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def name
  @name
end

#order_idObject

Returns the value of attribute order_id.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def order_id
  @order_id
end

#quantityObject

Returns the value of attribute quantity.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def quantity
  @quantity
end

#quantity_canceledObject

Returns the value of attribute quantity_canceled.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def quantity_canceled
  @quantity_canceled
end

#quantity_refundedObject

Returns the value of attribute quantity_refunded.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def quantity_refunded
  @quantity_refunded
end

#quantity_shippedObject

Returns the value of attribute quantity_shipped.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def quantity_shipped
  @quantity_shipped
end

#refundable_quantityObject

Returns the value of attribute refundable_quantity.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def refundable_quantity
  @refundable_quantity
end

#shippable_quantityObject

Returns the value of attribute shippable_quantity.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def shippable_quantity
  @shippable_quantity
end

#skuObject

Returns the value of attribute sku.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def sku
  @sku
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def status
  @status
end

#total_amountObject

Returns the value of attribute total_amount.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def total_amount
  @total_amount
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def type
  @type
end

#unit_priceObject

Returns the value of attribute unit_price.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def unit_price
  @unit_price
end

#vat_amountObject

Returns the value of attribute vat_amount.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def vat_amount
  @vat_amount
end

#vat_rateObject

Returns the value of attribute vat_rate.



4
5
6
# File 'lib/mollie/order/line.rb', line 4

def vat_rate
  @vat_rate
end

Class Method Details

.update(id, data = {}) ⇒ Object



32
33
34
# File 'lib/mollie/order/line.rb', line 32

def self.update(id, data = {})
  request('PATCH', id, data) { |response| Order.new(response) }
end

Instance Method Details

#cancel(options = {}) ⇒ Object



96
97
98
99
100
101
# File 'lib/mollie/order/line.rb', line 96

def cancel(options = {})
  qty = options.delete(:quantity) || quantity
  options[:lines] = [{ id: id, quantity: qty }]
  options[:order_id] = order_id
  Mollie::Order::Line.delete(nil, options)
end

#cancelable?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/mollie/order/line.rb', line 36

def cancelable?
  is_cancelable == true
end

#discounted?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/mollie/order/line.rb', line 40

def discounted?
  !@discount_amount.nil?
end

#image_urlObject



56
57
58
# File 'lib/mollie/order/line.rb', line 56

def image_url
  Util.extract_url(links, 'image_url')
end

#product_urlObject



52
53
54
# File 'lib/mollie/order/line.rb', line 52

def product_url
  Util.extract_url(links, 'product_url')
end

#refundable?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/mollie/order/line.rb', line 48

def refundable?
  refundable_quantity.to_i > 0
end

#shippable?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/mollie/order/line.rb', line 44

def shippable?
  shippable_quantity.to_i > 0
end