Class: ProcessOut::PayoutItem
- Inherits:
-
Object
- Object
- ProcessOut::PayoutItem
- Defined in:
- lib/processout/payout_item.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#fees ⇒ Object
Returns the value of attribute fees.
-
#gateway_resource_id ⇒ Object
Returns the value of attribute gateway_resource_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#payout ⇒ Object
Returns the value of attribute payout.
-
#payout_id ⇒ Object
Returns the value of attribute payout_id.
-
#project ⇒ Object
Returns the value of attribute project.
-
#project_id ⇒ Object
Returns the value of attribute project_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
-
Hash
of data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ PayoutItem
constructor
- Initializes the PayoutItem object Params:
client
ProcessOut
client instancedata
-
data that can be used to fill the object.
- Initializes the PayoutItem object Params:
-
#new(data = {}) ⇒ Object
Create a new PayoutItem using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data
-
Hash
of data.
- Prefills the object with the data passed as parameters Params:
Constructor Details
#initialize(client, data = {}) ⇒ PayoutItem
Initializes the PayoutItem object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/processout/payout_item.rb', line 118 def initialize(client, data = {}) @client = client self.id = data.fetch(:id, nil) self.project = data.fetch(:project, nil) self.project_id = data.fetch(:project_id, nil) self.payout = data.fetch(:payout, nil) self.payout_id = data.fetch(:payout_id, nil) self.transaction = data.fetch(:transaction, nil) self.transaction_id = data.fetch(:transaction_id, nil) self.type = data.fetch(:type, nil) self.gateway_resource_id = data.fetch(:gateway_resource_id, nil) self.amount = data.fetch(:amount, nil) self.fees = data.fetch(:fees, nil) self. = data.fetch(:metadata, nil) self.created_at = data.fetch(:created_at, nil) end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
19 20 21 |
# File 'lib/processout/payout_item.rb', line 19 def amount @amount end |
#created_at ⇒ Object
Returns the value of attribute created_at.
22 23 24 |
# File 'lib/processout/payout_item.rb', line 22 def created_at @created_at end |
#fees ⇒ Object
Returns the value of attribute fees.
20 21 22 |
# File 'lib/processout/payout_item.rb', line 20 def fees @fees end |
#gateway_resource_id ⇒ Object
Returns the value of attribute gateway_resource_id.
18 19 20 |
# File 'lib/processout/payout_item.rb', line 18 def gateway_resource_id @gateway_resource_id end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/processout/payout_item.rb', line 10 def id @id end |
#metadata ⇒ Object
Returns the value of attribute metadata.
21 22 23 |
# File 'lib/processout/payout_item.rb', line 21 def @metadata end |
#payout ⇒ Object
Returns the value of attribute payout.
13 14 15 |
# File 'lib/processout/payout_item.rb', line 13 def payout @payout end |
#payout_id ⇒ Object
Returns the value of attribute payout_id.
14 15 16 |
# File 'lib/processout/payout_item.rb', line 14 def payout_id @payout_id end |
#project ⇒ Object
Returns the value of attribute project.
11 12 13 |
# File 'lib/processout/payout_item.rb', line 11 def project @project end |
#project_id ⇒ Object
Returns the value of attribute project_id.
12 13 14 |
# File 'lib/processout/payout_item.rb', line 12 def project_id @project_id end |
#transaction ⇒ Object
Returns the value of attribute transaction.
15 16 17 |
# File 'lib/processout/payout_item.rb', line 15 def transaction @transaction end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
16 17 18 |
# File 'lib/processout/payout_item.rb', line 16 def transaction_id @transaction_id end |
#type ⇒ Object
Returns the value of attribute type.
17 18 19 |
# File 'lib/processout/payout_item.rb', line 17 def type @type 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
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 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 |
# File 'lib/processout/payout_item.rb', line 145 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? "project_id" self.project_id = data["project_id"] end if data.include? "payout" self.payout = data["payout"] end if data.include? "payout_id" self.payout_id = data["payout_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? "type" self.type = data["type"] end if data.include? "gateway_resource_id" self.gateway_resource_id = data["gateway_resource_id"] end if data.include? "amount" self.amount = data["amount"] end if data.include? "fees" self.fees = data["fees"] end if data.include? "metadata" self. = data["metadata"] end if data.include? "created_at" self.created_at = data["created_at"] end self end |
#new(data = {}) ⇒ Object
Create a new PayoutItem using the current client
138 139 140 |
# File 'lib/processout/payout_item.rb', line 138 def new(data = {}) PayoutItem.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/processout/payout_item.rb', line 195 def prefill(data) if data.nil? return self end self.id = data.fetch(:id, self.id) self.project = data.fetch(:project, self.project) self.project_id = data.fetch(:project_id, self.project_id) self.payout = data.fetch(:payout, self.payout) self.payout_id = data.fetch(:payout_id, self.payout_id) self.transaction = data.fetch(:transaction, self.transaction) self.transaction_id = data.fetch(:transaction_id, self.transaction_id) self.type = data.fetch(:type, self.type) self.gateway_resource_id = data.fetch(:gateway_resource_id, self.gateway_resource_id) self.amount = data.fetch(:amount, self.amount) self.fees = data.fetch(:fees, self.fees) self. = data.fetch(:metadata, self.) self.created_at = data.fetch(:created_at, self.created_at) self end |