Class: ProcessOut::Gateway
- Inherits:
-
Object
- Object
- ProcessOut::Gateway
- Defined in:
- lib/processout/gateway.rb
Instance Attribute Summary collapse
-
#can_pull_transactions ⇒ Object
Returns the value of attribute can_pull_transactions.
-
#can_refund ⇒ Object
Returns the value of attribute can_refund.
-
#description ⇒ Object
Returns the value of attribute description.
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#flows ⇒ Object
Returns the value of attribute flows.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_oauth_authentication ⇒ Object
Returns the value of attribute is_oauth_authentication.
-
#logo_url ⇒ Object
Returns the value of attribute logo_url.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#fetch_gateway_configurations(options = {}) ⇒ Object
- Get all the gateway configurations of the gateway Params:
options -
Hashof options.
- Get all the gateway configurations of the gateway Params:
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data -
Hashof data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ Gateway
constructor
- Initializes the Gateway object Params:
client ProcessOutclient instancedata-
data that can be used to fill the object.
- Initializes the Gateway object Params:
-
#new(data = {}) ⇒ Object
Create a new Gateway using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data -
Hashof 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 = {}) ⇒ Gateway
Initializes the Gateway object Params:
client-
ProcessOutclient instance data-
data that can be used to fill the object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/processout/gateway.rb', line 73 def initialize(client, data = {}) @client = client self.id = data.fetch(:id, nil) self.name = data.fetch(:name, nil) self.display_name = data.fetch(:display_name, nil) self.logo_url = data.fetch(:logo_url, nil) self.url = data.fetch(:url, nil) self.flows = data.fetch(:flows, nil) self. = data.fetch(:tags, nil) self.can_pull_transactions = data.fetch(:can_pull_transactions, nil) self.can_refund = data.fetch(:can_refund, nil) self.is_oauth_authentication = data.fetch(:is_oauth_authentication, nil) self.description = data.fetch(:description, nil) end |
Instance Attribute Details
#can_pull_transactions ⇒ Object
Returns the value of attribute can_pull_transactions.
18 19 20 |
# File 'lib/processout/gateway.rb', line 18 def can_pull_transactions @can_pull_transactions end |
#can_refund ⇒ Object
Returns the value of attribute can_refund.
19 20 21 |
# File 'lib/processout/gateway.rb', line 19 def can_refund @can_refund end |
#description ⇒ Object
Returns the value of attribute description.
21 22 23 |
# File 'lib/processout/gateway.rb', line 21 def description @description end |
#display_name ⇒ Object
Returns the value of attribute display_name.
13 14 15 |
# File 'lib/processout/gateway.rb', line 13 def display_name @display_name end |
#flows ⇒ Object
Returns the value of attribute flows.
16 17 18 |
# File 'lib/processout/gateway.rb', line 16 def flows @flows end |
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/processout/gateway.rb', line 11 def id @id end |
#is_oauth_authentication ⇒ Object
Returns the value of attribute is_oauth_authentication.
20 21 22 |
# File 'lib/processout/gateway.rb', line 20 def is_oauth_authentication @is_oauth_authentication end |
#logo_url ⇒ Object
Returns the value of attribute logo_url.
14 15 16 |
# File 'lib/processout/gateway.rb', line 14 def logo_url @logo_url end |
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/processout/gateway.rb', line 12 def name @name end |
#tags ⇒ Object
Returns the value of attribute tags.
17 18 19 |
# File 'lib/processout/gateway.rb', line 17 def @tags end |
#url ⇒ Object
Returns the value of attribute url.
15 16 17 |
# File 'lib/processout/gateway.rb', line 15 def url @url end |
Instance Method Details
#fetch_gateway_configurations(options = {}) ⇒ Object
Get all the gateway configurations of the gateway Params:
options-
Hashof options
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/processout/gateway.rb', line 181 def fetch_gateway_configurations( = {}) self.prefill() request = Request.new(@client) path = "/gateways/" + CGI.escape(@name) + "/gateway-configurations" data = { } response = Response.new(request.get(path, data, )) return_values = Array.new a = Array.new body = response.body for v in body['gateway_configurations'] tmp = GatewayConfiguration.new(@client) tmp.fill_with_data(v) a.push(tmp) end return_values.push(a) return_values[0] end |
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data-
Hashof data coming from the API
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/processout/gateway.rb', line 115 def fill_with_data(data) if data.nil? return self end if data.include? "id" self.id = data["id"] end if data.include? "name" self.name = data["name"] end if data.include? "display_name" self.display_name = data["display_name"] end if data.include? "logo_url" self.logo_url = data["logo_url"] end if data.include? "url" self.url = data["url"] end if data.include? "flows" self.flows = data["flows"] end if data.include? "tags" self. = data["tags"] end if data.include? "can_pull_transactions" self.can_pull_transactions = data["can_pull_transactions"] end if data.include? "can_refund" self.can_refund = data["can_refund"] end if data.include? "is_oauth_authentication" self.is_oauth_authentication = data["is_oauth_authentication"] end if data.include? "description" self.description = data["description"] end self end |
#new(data = {}) ⇒ Object
Create a new Gateway using the current client
91 92 93 |
# File 'lib/processout/gateway.rb', line 91 def new(data = {}) Gateway.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data-
Hashof data
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/processout/gateway.rb', line 159 def prefill(data) if data.nil? return self end self.id = data.fetch(:id, self.id) self.name = data.fetch(:name, self.name) self.display_name = data.fetch(:display_name, self.display_name) self.logo_url = data.fetch(:logo_url, self.logo_url) self.url = data.fetch(:url, self.url) self.flows = data.fetch(:flows, self.flows) self. = data.fetch(:tags, self.) self.can_pull_transactions = data.fetch(:can_pull_transactions, self.can_pull_transactions) self.can_refund = data.fetch(:can_refund, self.can_refund) self.is_oauth_authentication = data.fetch(:is_oauth_authentication, self.is_oauth_authentication) self.description = data.fetch(:description, self.description) self end |
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/processout/gateway.rb', line 96 def to_json() { "id": self.id, "name": self.name, "display_name": self.display_name, "logo_url": self.logo_url, "url": self.url, "flows": self.flows, "tags": self., "can_pull_transactions": self.can_pull_transactions, "can_refund": self.can_refund, "is_oauth_authentication": self.is_oauth_authentication, "description": self.description, }.to_json end |