Class: ProcessOut::PayoutItem

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/processout/payout_item.rb', line 113

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_id = data.fetch(:gateway_id, nil)
  self.fee = data.fetch(:fee, nil)
  self. = data.fetch(:metadata, nil)
  self.created_at = data.fetch(:created_at, nil)
  
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



21
22
23
# File 'lib/processout/payout_item.rb', line 21

def created_at
  @created_at
end

#feeObject

Returns the value of attribute fee.



19
20
21
# File 'lib/processout/payout_item.rb', line 19

def fee
  @fee
end

#gateway_idObject

Returns the value of attribute gateway_id.



18
19
20
# File 'lib/processout/payout_item.rb', line 18

def gateway_id
  @gateway_id
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#metadataObject

Returns the value of attribute metadata.



20
21
22
# File 'lib/processout/payout_item.rb', line 20

def 
  @metadata
end

#payoutObject

Returns the value of attribute payout.



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

def payout
  @payout
end

#payout_idObject

Returns the value of attribute payout_id.



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

def payout_id
  @payout_id
end

#projectObject

Returns the value of attribute project.



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

def project
  @project
end

#project_idObject

Returns the value of attribute project_id.



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

def project_id
  @project_id
end

#transactionObject

Returns the value of attribute transaction.



15
16
17
# File 'lib/processout/payout_item.rb', line 15

def transaction
  @transaction
end

#transaction_idObject

Returns the value of attribute transaction_id.



16
17
18
# File 'lib/processout/payout_item.rb', line 16

def transaction_id
  @transaction_id
end

#typeObject

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



139
140
141
142
143
144
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
# File 'lib/processout/payout_item.rb', line 139

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_id"
    self.gateway_id = data["gateway_id"]
  end
  if data.include? "fee"
    self.fee = data["fee"]
  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



132
133
134
# File 'lib/processout/payout_item.rb', line 132

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



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/processout/payout_item.rb', line 186

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_id = data.fetch(:gateway_id, self.gateway_id)
  self.fee = data.fetch(:fee, self.fee)
  self. = data.fetch(:metadata, self.)
  self.created_at = data.fetch(:created_at, self.created_at)
  
  self
end