Class: Remitmd::Stream

Inherits:
Model
  • Object
show all
Defined in:
lib/remitmd/models.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#inspect, #to_h

Constructor Details

#initialize(attrs) ⇒ Stream

Returns a new instance of Stream.



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/remitmd/models.rb', line 252

def initialize(attrs)
  h = attrs.transform_keys(&:to_s)
  @id              = h["id"]
  @payer           = h["payer"] || h["sender"]
  @payee           = h["payee"] || h["recipient"]
  @rate_per_second = decimal(h["rate_per_second"] || h["rate_per_sec"])
  @deposited       = decimal(h["deposited"])
  @total_streamed  = decimal(h["total_streamed"] || h["withdrawn"] || "0")
  @max_duration    = h["max_duration"]
  @max_total       = decimal(h["max_total"])
  @status          = h["status"]
  @started_at      = parse_time(h["started_at"])
  @ends_at         = parse_time(h["ends_at"])
  @closed_at       = parse_time(h["closed_at"])
end

Instance Attribute Details

#closed_atObject (readonly)

Returns the value of attribute closed_at.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def closed_at
  @closed_at
end

#depositedObject (readonly)

Returns the value of attribute deposited.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def deposited
  @deposited
end

#ends_atObject (readonly)

Returns the value of attribute ends_at.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def ends_at
  @ends_at
end

#idObject (readonly)

Returns the value of attribute id.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def id
  @id
end

#max_durationObject (readonly)

Returns the value of attribute max_duration.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def max_duration
  @max_duration
end

#max_totalObject (readonly)

Returns the value of attribute max_total.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def max_total
  @max_total
end

#payeeObject (readonly) Also known as: recipient

Returns the value of attribute payee.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def payee
  @payee
end

#payerObject (readonly) Also known as: sender

Returns the value of attribute payer.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def payer
  @payer
end

#rate_per_secondObject (readonly) Also known as: rate_per_sec

Returns the value of attribute rate_per_second.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def rate_per_second
  @rate_per_second
end

#started_atObject (readonly)

Returns the value of attribute started_at.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def started_at
  @started_at
end

#statusObject (readonly)

Returns the value of attribute status.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def status
  @status
end

#total_streamedObject (readonly) Also known as: withdrawn

Returns the value of attribute total_streamed.



268
269
270
# File 'lib/remitmd/models.rb', line 268

def total_streamed
  @total_streamed
end