Class: ProcessOut::GatewayConfiguration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data = {}) ⇒ GatewayConfiguration

Initializes the GatewayConfiguration object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



56
57
58
59
60
61
62
63
64
65
# File 'lib/processout/gateway_configuration.rb', line 56

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

  self.id = data.fetch(:id, nil)
  self.project = data.fetch(:project, nil)
  self.gateway = data.fetch(:gateway, nil)
  self.enabled = data.fetch(:enabled, nil)
  self.public_keys = data.fetch(:public_keys, nil)
  
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



13
14
15
# File 'lib/processout/gateway_configuration.rb', line 13

def enabled
  @enabled
end

#gatewayObject

Returns the value of attribute gateway.



12
13
14
# File 'lib/processout/gateway_configuration.rb', line 12

def gateway
  @gateway
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#projectObject

Returns the value of attribute project.



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

def project
  @project
end

#public_keysObject

Returns the value of attribute public_keys.



14
15
16
# File 'lib/processout/gateway_configuration.rb', line 14

def public_keys
  @public_keys
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



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/processout/gateway_configuration.rb', line 75

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "id"
    self.id = data["id"]
  end
  if data.include? "project"
    self.project = data["project"]
  end
  if data.include? "gateway"
    self.gateway = data["gateway"]
  end
  if data.include? "enabled"
    self.enabled = data["enabled"]
  end
  if data.include? "public_keys"
    self.public_keys = data["public_keys"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new GatewayConfiguration using the current client



68
69
70
# File 'lib/processout/gateway_configuration.rb', line 68

def new(data = {})
  GatewayConfiguration.new(@client, data)
end

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/processout/gateway_configuration.rb', line 101

def prefill(data)
  if data.nil?
    return self
  end
  self.id = data.fetch(:id, self.id)
  self.project = data.fetch(:project, self.project)
  self.gateway = data.fetch(:gateway, self.gateway)
  self.enabled = data.fetch(:enabled, self.enabled)
  self.public_keys = data.fetch(:public_keys, self.public_keys)
  
  self
end