Class: ProcessOut::InvoiceDevice

Inherits:
Object
  • Object
show all
Defined in:
lib/processout/invoice_device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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



27
28
29
30
31
32
33
# File 'lib/processout/invoice_device.rb', line 27

def initialize(client, data = {})
  @client = client

  self.channel = data.fetch(:channel, nil)
  self.ip_address = data.fetch(:ip_address, nil)
  
end

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



10
11
12
# File 'lib/processout/invoice_device.rb', line 10

def channel
  @channel
end

#ip_addressObject

Returns the value of attribute ip_address.



11
12
13
# File 'lib/processout/invoice_device.rb', line 11

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



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/processout/invoice_device.rb', line 43

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
  
  self
end

#new(data = {}) ⇒ Object

Create a new InvoiceDevice using the current client



36
37
38
# File 'lib/processout/invoice_device.rb', line 36

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



60
61
62
63
64
65
66
67
68
# File 'lib/processout/invoice_device.rb', line 60

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
end