class ProcessOut::InvoiceDetail
Attributes
amount[R]
brand[R]
category[R]
condition[R]
description[R]
discount_amount[R]
marketplace_merchant[R]
marketplace_merchant_created_at[R]
marketplace_merchant_is_business[R]
metadata[R]
model[R]
name[R]
quantity[R]
reference[R]
type[R]
Public Class Methods
new(client, data = {})
click to toggle source
Initializes the InvoiceDetail
object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
# File lib/processout/invoice_detail.rb, line 93 def initialize(client, data = {}) @client = client self.name = data.fetch(:name, nil) self.type = data.fetch(:type, nil) self.amount = data.fetch(:amount, nil) self.quantity = data.fetch(:quantity, nil) self.metadata = data.fetch(:metadata, nil) self.reference = data.fetch(:reference, nil) self.description = data.fetch(:description, nil) self.brand = data.fetch(:brand, nil) self.model = data.fetch(:model, nil) self.discount_amount = data.fetch(:discount_amount, nil) self.condition = data.fetch(:condition, nil) self.marketplace_merchant = data.fetch(:marketplace_merchant, nil) self.marketplace_merchant_is_business = data.fetch(:marketplace_merchant_is_business, nil) self.marketplace_merchant_created_at = data.fetch(:marketplace_merchant_created_at, nil) self.category = data.fetch(:category, nil) end
Public Instance Methods
amount=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 36 def amount=(val) @amount = val end
brand=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 56 def brand=(val) @brand = val end
category=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 84 def category=(val) @category = val end
condition=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 68 def condition=(val) @condition = val end
description=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 52 def description=(val) @description = val end
discount_amount=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 64 def discount_amount=(val) @discount_amount = val end
fill_with_data(data)
click to toggle source
Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API
# File lib/processout/invoice_detail.rb, line 143 def fill_with_data(data) if data.nil? return self end if data.include? "name" self.name = data["name"] end if data.include? "type" self.type = data["type"] end if data.include? "amount" self.amount = data["amount"] end if data.include? "quantity" self.quantity = data["quantity"] end if data.include? "metadata" self.metadata = data["metadata"] end if data.include? "reference" self.reference = data["reference"] end if data.include? "description" self.description = data["description"] end if data.include? "brand" self.brand = data["brand"] end if data.include? "model" self.model = data["model"] end if data.include? "discount_amount" self.discount_amount = data["discount_amount"] end if data.include? "condition" self.condition = data["condition"] end if data.include? "marketplace_merchant" self.marketplace_merchant = data["marketplace_merchant"] end if data.include? "marketplace_merchant_is_business" self.marketplace_merchant_is_business = data["marketplace_merchant_is_business"] end if data.include? "marketplace_merchant_created_at" self.marketplace_merchant_created_at = data["marketplace_merchant_created_at"] end if data.include? "category" self.category = data["category"] end self end
marketplace_merchant=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 72 def marketplace_merchant=(val) @marketplace_merchant = val end
marketplace_merchant_created_at=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 80 def marketplace_merchant_created_at=(val) @marketplace_merchant_created_at = val end
marketplace_merchant_is_business=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 76 def marketplace_merchant_is_business=(val) @marketplace_merchant_is_business = val end
metadata=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 44 def metadata=(val) @metadata = val end
model=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 60 def model=(val) @model = val end
name=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 28 def name=(val) @name = val end
new(data = {})
click to toggle source
Create a new InvoiceDetail
using the current client
# File lib/processout/invoice_detail.rb, line 115 def new(data = {}) InvoiceDetail.new(@client, data) end
prefill(data)
click to toggle source
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
# File lib/processout/invoice_detail.rb, line 199 def prefill(data) if data.nil? return self end self.name = data.fetch(:name, self.name) self.type = data.fetch(:type, self.type) self.amount = data.fetch(:amount, self.amount) self.quantity = data.fetch(:quantity, self.quantity) self.metadata = data.fetch(:metadata, self.metadata) self.reference = data.fetch(:reference, self.reference) self.description = data.fetch(:description, self.description) self.brand = data.fetch(:brand, self.brand) self.model = data.fetch(:model, self.model) self.discount_amount = data.fetch(:discount_amount, self.discount_amount) self.condition = data.fetch(:condition, self.condition) self.marketplace_merchant = data.fetch(:marketplace_merchant, self.marketplace_merchant) self.marketplace_merchant_is_business = data.fetch(:marketplace_merchant_is_business, self.marketplace_merchant_is_business) self.marketplace_merchant_created_at = data.fetch(:marketplace_merchant_created_at, self.marketplace_merchant_created_at) self.category = data.fetch(:category, self.category) self end
quantity=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 40 def quantity=(val) @quantity = val end
reference=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 48 def reference=(val) @reference = val end
to_json(options)
click to toggle source
Overrides the JSON marshaller to only send the fields we want
# File lib/processout/invoice_detail.rb, line 120 def to_json(options) { "name": self.name, "type": self.type, "amount": self.amount, "quantity": self.quantity, "metadata": self.metadata, "reference": self.reference, "description": self.description, "brand": self.brand, "model": self.model, "discount_amount": self.discount_amount, "condition": self.condition, "marketplace_merchant": self.marketplace_merchant, "marketplace_merchant_is_business": self.marketplace_merchant_is_business, "marketplace_merchant_created_at": self.marketplace_merchant_created_at, "category": self.category, }.to_json end
type=(val)
click to toggle source
# File lib/processout/invoice_detail.rb, line 32 def type=(val) @type = val end