class ProcessOut::InvoiceDevice

Attributes

channel[R]
id[R]
ip_address[R]

Public Class Methods

new(client, data = {}) click to toggle source

Initializes the InvoiceDevice object Params:

client

ProcessOut client instance

data

data that can be used to fill the object

# 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

Public Instance Methods

channel=(val) click to toggle source
# File lib/processout/invoice_device.rb, line 16
def channel=(val)
  @channel = 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_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
id=(val) click to toggle source
# File lib/processout/invoice_device.rb, line 24
def id=(val)
  @id = val
end
ip_address=(val) click to toggle source
# File lib/processout/invoice_device.rb, line 20
def ip_address=(val)
  @ip_address = val
end
new(data = {}) click to toggle source

Create a new InvoiceDevice using the current client

# File lib/processout/invoice_device.rb, line 43
def new(data = {})
  InvoiceDevice.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_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) click to toggle source

Overrides the JSON marshaller to only send the fields we want

# File lib/processout/invoice_device.rb, line 48
def to_json(options)
  {
      "channel": self.channel,
      "ip_address": self.ip_address,
      "id": self.id,
  }.to_json
end