Class: ProcessOut::TransactionOperation
- Inherits:
-
Object
- Object
- ProcessOut::TransactionOperation
- Defined in:
- lib/processout/transaction_operation.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#card ⇒ Object
Returns the value of attribute card.
-
#card_id ⇒ Object
Returns the value of attribute card_id.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#gateway_fee ⇒ Object
Returns the value of attribute gateway_fee.
-
#has_failed ⇒ Object
Returns the value of attribute has_failed.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_accountable ⇒ Object
Returns the value of attribute is_accountable.
-
#is_attempt ⇒ Object
Returns the value of attribute is_attempt.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#token ⇒ Object
Returns the value of attribute token.
-
#token_id ⇒ Object
Returns the value of attribute token_id.
-
#transaction ⇒ Object
Returns the value of attribute transaction.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#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 = {}) ⇒ TransactionOperation
constructor
- Initializes the TransactionOperation object Params:
client ProcessOutclient instancedata-
data that can be used to fill the object.
- Initializes the TransactionOperation object Params:
-
#new(data = {}) ⇒ Object
Create a new TransactionOperation 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:
Constructor Details
#initialize(client, data = {}) ⇒ TransactionOperation
Initializes the TransactionOperation object Params:
client-
ProcessOutclient instance data-
data that can be used to fill the object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/processout/transaction_operation.rb', line 133 def initialize(client, data = {}) @client = client self.id = data.fetch(:id, nil) self.transaction = data.fetch(:transaction, nil) self.transaction_id = data.fetch(:transaction_id, nil) self.token = data.fetch(:token, nil) self.token_id = data.fetch(:token_id, nil) self.card = data.fetch(:card, nil) self.card_id = data.fetch(:card_id, nil) self.amount = data.fetch(:amount, nil) self.is_attempt = data.fetch(:is_attempt, nil) self.has_failed = data.fetch(:has_failed, nil) self.is_accountable = data.fetch(:is_accountable, nil) self.type = data.fetch(:type, nil) self.error_code = data.fetch(:error_code, nil) self. = data.fetch(:metadata, nil) self.gateway_fee = data.fetch(:gateway_fee, nil) self.created_at = data.fetch(:created_at, nil) end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
17 18 19 |
# File 'lib/processout/transaction_operation.rb', line 17 def amount @amount end |
#card ⇒ Object
Returns the value of attribute card.
15 16 17 |
# File 'lib/processout/transaction_operation.rb', line 15 def card @card end |
#card_id ⇒ Object
Returns the value of attribute card_id.
16 17 18 |
# File 'lib/processout/transaction_operation.rb', line 16 def card_id @card_id end |
#created_at ⇒ Object
Returns the value of attribute created_at.
25 26 27 |
# File 'lib/processout/transaction_operation.rb', line 25 def created_at @created_at end |
#error_code ⇒ Object
Returns the value of attribute error_code.
22 23 24 |
# File 'lib/processout/transaction_operation.rb', line 22 def error_code @error_code end |
#gateway_fee ⇒ Object
Returns the value of attribute gateway_fee.
24 25 26 |
# File 'lib/processout/transaction_operation.rb', line 24 def gateway_fee @gateway_fee end |
#has_failed ⇒ Object
Returns the value of attribute has_failed.
19 20 21 |
# File 'lib/processout/transaction_operation.rb', line 19 def has_failed @has_failed end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/processout/transaction_operation.rb', line 10 def id @id end |
#is_accountable ⇒ Object
Returns the value of attribute is_accountable.
20 21 22 |
# File 'lib/processout/transaction_operation.rb', line 20 def is_accountable @is_accountable end |
#is_attempt ⇒ Object
Returns the value of attribute is_attempt.
18 19 20 |
# File 'lib/processout/transaction_operation.rb', line 18 def is_attempt @is_attempt end |
#metadata ⇒ Object
Returns the value of attribute metadata.
23 24 25 |
# File 'lib/processout/transaction_operation.rb', line 23 def @metadata end |
#token ⇒ Object
Returns the value of attribute token.
13 14 15 |
# File 'lib/processout/transaction_operation.rb', line 13 def token @token end |
#token_id ⇒ Object
Returns the value of attribute token_id.
14 15 16 |
# File 'lib/processout/transaction_operation.rb', line 14 def token_id @token_id end |
#transaction ⇒ Object
Returns the value of attribute transaction.
11 12 13 |
# File 'lib/processout/transaction_operation.rb', line 11 def transaction @transaction end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
12 13 14 |
# File 'lib/processout/transaction_operation.rb', line 12 def transaction_id @transaction_id end |
#type ⇒ Object
Returns the value of attribute type.
21 22 23 |
# File 'lib/processout/transaction_operation.rb', line 21 def type @type end |
Instance Method Details
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data-
Hashof data coming from the API
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 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 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/processout/transaction_operation.rb', line 163 def fill_with_data(data) if data.nil? return self end if data.include? "id" self.id = data["id"] end if data.include? "transaction" self.transaction = data["transaction"] end if data.include? "transaction_id" self.transaction_id = data["transaction_id"] end if data.include? "token" self.token = data["token"] end if data.include? "token_id" self.token_id = data["token_id"] end if data.include? "card" self.card = data["card"] end if data.include? "card_id" self.card_id = data["card_id"] end if data.include? "amount" self.amount = data["amount"] end if data.include? "is_attempt" self.is_attempt = data["is_attempt"] end if data.include? "has_failed" self.has_failed = data["has_failed"] end if data.include? "is_accountable" self.is_accountable = data["is_accountable"] end if data.include? "type" self.type = data["type"] end if data.include? "error_code" self.error_code = data["error_code"] end if data.include? "metadata" self. = data["metadata"] end if data.include? "gateway_fee" self.gateway_fee = data["gateway_fee"] end if data.include? "created_at" self.created_at = data["created_at"] end self end |
#new(data = {}) ⇒ Object
Create a new TransactionOperation using the current client
156 157 158 |
# File 'lib/processout/transaction_operation.rb', line 156 def new(data = {}) TransactionOperation.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data-
Hashof data
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/processout/transaction_operation.rb', line 222 def prefill(data) if data.nil? return self end self.id = data.fetch(:id, self.id) self.transaction = data.fetch(:transaction, self.transaction) self.transaction_id = data.fetch(:transaction_id, self.transaction_id) self.token = data.fetch(:token, self.token) self.token_id = data.fetch(:token_id, self.token_id) self.card = data.fetch(:card, self.card) self.card_id = data.fetch(:card_id, self.card_id) self.amount = data.fetch(:amount, self.amount) self.is_attempt = data.fetch(:is_attempt, self.is_attempt) self.has_failed = data.fetch(:has_failed, self.has_failed) self.is_accountable = data.fetch(:is_accountable, self.is_accountable) self.type = data.fetch(:type, self.type) self.error_code = data.fetch(:error_code, self.error_code) self. = data.fetch(:metadata, self.) self.gateway_fee = data.fetch(:gateway_fee, self.gateway_fee) self.created_at = data.fetch(:created_at, self.created_at) self end |