Class: ProcessOut::InvoiceDevice
- Inherits:
-
Object
- Object
- ProcessOut::InvoiceDevice
- Defined in:
- lib/processout/invoice_device.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
Instance Method Summary collapse
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ InvoiceDevice
constructor
- Initializes the InvoiceDevice object Params:
client
ProcessOut
client instancedata
-
data that can be used to fill the object.
- Initializes the InvoiceDevice object Params:
-
#new(data = {}) ⇒ Object
Create a new InvoiceDevice using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data
-
Hash
of data.
- Prefills the object with the data passed as parameters Params:
-
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want.
Constructor Details
#initialize(client, data = {}) ⇒ InvoiceDevice
Initializes the InvoiceDevice object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
33 34 35 36 37 38 39 40 |
# File 'lib/processout/invoice_device.rb', line 33 def initialize(client, data = {}) @client = client self.channel = data.fetch(:channel, nil) self.ip_address = data.fetch(:ip_address, nil) self.id = data.fetch(:id, nil) end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
11 12 13 |
# File 'lib/processout/invoice_device.rb', line 11 def channel @channel end |
#id ⇒ Object
Returns the value of attribute id.
13 14 15 |
# File 'lib/processout/invoice_device.rb', line 13 def id @id end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
12 13 14 |
# File 'lib/processout/invoice_device.rb', line 12 def ip_address @ip_address end |
Instance Method Details
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/processout/invoice_device.rb', line 59 def fill_with_data(data) if data.nil? return self end if data.include? "channel" self.channel = data["channel"] end if data.include? "ip_address" self.ip_address = data["ip_address"] end if data.include? "id" self.id = data["id"] end self end |
#new(data = {}) ⇒ Object
Create a new InvoiceDevice using the current client
43 44 45 |
# File 'lib/processout/invoice_device.rb', line 43 def new(data = {}) InvoiceDevice.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/processout/invoice_device.rb', line 79 def prefill(data) if data.nil? return self end self.channel = data.fetch(:channel, self.channel) self.ip_address = data.fetch(:ip_address, self.ip_address) self.id = data.fetch(:id, self.id) self end |
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want
48 49 50 51 52 53 54 |
# File 'lib/processout/invoice_device.rb', line 48 def to_json() { "channel": self.channel, "ip_address": self.ip_address, "id": self.id, }.to_json end |