class ProcessOut::InvoiceShipping
Attributes
address1[R]
address2[R]
amount[R]
city[R]
country_code[R]
delay[R]
expects_shipping_at[R]
method[R]
phone_number[R]
provider[R]
state[R]
zip[R]
Public Class Methods
new(client, data = {})
click to toggle source
Initializes the InvoiceShipping
object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
# File lib/processout/invoice_shipping.rb, line 78 def initialize(client, data = {}) @client = client self.amount = data.fetch(:amount, nil) self.method = data.fetch(:method, nil) self.provider = data.fetch(:provider, nil) self.delay = data.fetch(:delay, nil) self.address1 = data.fetch(:address1, nil) self.address2 = data.fetch(:address2, nil) self.city = data.fetch(:city, nil) self.state = data.fetch(:state, nil) self.country_code = data.fetch(:country_code, nil) self.zip = data.fetch(:zip, nil) self.phone_number = data.fetch(:phone_number, nil) self.expects_shipping_at = data.fetch(:expects_shipping_at, nil) end
Public Instance Methods
address1=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 41 def address1=(val) @address1 = val end
address2=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 45 def address2=(val) @address2 = val end
amount=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 25 def amount=(val) @amount = val end
city=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 49 def city=(val) @city = val end
country_code=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 57 def country_code=(val) @country_code = val end
delay=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 37 def delay=(val) @delay = val end
expects_shipping_at=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 69 def expects_shipping_at=(val) @expects_shipping_at = 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_shipping.rb, line 122 def fill_with_data(data) if data.nil? return self end if data.include? "amount" self.amount = data["amount"] end if data.include? "method" self.method = data["method"] end if data.include? "provider" self.provider = data["provider"] end if data.include? "delay" self.delay = data["delay"] end if data.include? "address1" self.address1 = data["address1"] end if data.include? "address2" self.address2 = data["address2"] end if data.include? "city" self.city = data["city"] end if data.include? "state" self.state = data["state"] end if data.include? "country_code" self.country_code = data["country_code"] end if data.include? "zip" self.zip = data["zip"] end if data.include? "phone_number" self.phone_number = data["phone_number"] end if data.include? "expects_shipping_at" self.expects_shipping_at = data["expects_shipping_at"] end self end
method=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 29 def method=(val) @method = val end
new(data = {})
click to toggle source
Create a new InvoiceShipping
using the current client
# File lib/processout/invoice_shipping.rb, line 97 def new(data = {}) InvoiceShipping.new(@client, data) end
phone_number=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 65 def phone_number=(val) @phone_number = val 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_shipping.rb, line 169 def prefill(data) if data.nil? return self end self.amount = data.fetch(:amount, self.amount) self.method = data.fetch(:method, self.method) self.provider = data.fetch(:provider, self.provider) self.delay = data.fetch(:delay, self.delay) self.address1 = data.fetch(:address1, self.address1) self.address2 = data.fetch(:address2, self.address2) self.city = data.fetch(:city, self.city) self.state = data.fetch(:state, self.state) self.country_code = data.fetch(:country_code, self.country_code) self.zip = data.fetch(:zip, self.zip) self.phone_number = data.fetch(:phone_number, self.phone_number) self.expects_shipping_at = data.fetch(:expects_shipping_at, self.expects_shipping_at) self end
provider=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 33 def provider=(val) @provider = val end
state=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 53 def state=(val) @state = val end
to_json(options)
click to toggle source
Overrides the JSON marshaller to only send the fields we want
# File lib/processout/invoice_shipping.rb, line 102 def to_json(options) { "amount": self.amount, "method": self.method, "provider": self.provider, "delay": self.delay, "address1": self.address1, "address2": self.address2, "city": self.city, "state": self.state, "country_code": self.country_code, "zip": self.zip, "phone_number": self.phone_number, "expects_shipping_at": self.expects_shipping_at, }.to_json end
zip=(val)
click to toggle source
# File lib/processout/invoice_shipping.rb, line 61 def zip=(val) @zip = val end