class ProcessOut::InvoiceTax
Attributes
amount[R]
rate[R]
Public Class Methods
new(client, data = {})
click to toggle source
Initializes the InvoiceTax
object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
# File lib/processout/invoice_tax.rb, line 28 def initialize(client, data = {}) @client = client self.amount = data.fetch(:amount, nil) self.rate = data.fetch(:rate, nil) end
Public Instance Methods
amount=(val)
click to toggle source
# File lib/processout/invoice_tax.rb, line 15 def amount=(val) @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_tax.rb, line 52 def fill_with_data(data) if data.nil? return self end if data.include? "amount" self.amount = data["amount"] end if data.include? "rate" self.rate = data["rate"] end self end
new(data = {})
click to toggle source
Create a new InvoiceTax
using the current client
# File lib/processout/invoice_tax.rb, line 37 def new(data = {}) InvoiceTax.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_tax.rb, line 69 def prefill(data) if data.nil? return self end self.amount = data.fetch(:amount, self.amount) self.rate = data.fetch(:rate, self.rate) self end
rate=(val)
click to toggle source
# File lib/processout/invoice_tax.rb, line 19 def rate=(val) @rate = val end
to_json(options)
click to toggle source
Overrides the JSON marshaller to only send the fields we want
# File lib/processout/invoice_tax.rb, line 42 def to_json(options) { "amount": self.amount, "rate": self.rate, }.to_json end