Class: Remitmd::Bounty

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) ⇒ Bounty

Returns a new instance of Bounty.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/remitmd/models.rb', line 282

def initialize(attrs)
  h = attrs.transform_keys(&:to_s)
  @id           = h["id"]
  @poster       = h["poster"]
  @amount       = decimal(h["amount"] || h["award"])
  @task         = h["task"] || h["task_description"] || h["description"]
  @submissions  = h["submissions"] || []
  @validation   = h["validation"]
  @max_attempts = h["max_attempts"]
  @deadline     = h["deadline"]
  @status       = h["status"]
  @winner       = h["winner"] || ""
  @expires_at   = parse_time(h["expires_at"])
  @created_at   = parse_time(h["created_at"])
end

Instance Attribute Details

#amountObject (readonly) Also known as: award

Returns the value of attribute amount.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def amount
  @amount
end

#created_atObject (readonly)

Returns the value of attribute created_at.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def created_at
  @created_at
end

#deadlineObject (readonly)

Returns the value of attribute deadline.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def deadline
  @deadline
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def expires_at
  @expires_at
end

#idObject (readonly)

Returns the value of attribute id.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def id
  @id
end

#max_attemptsObject (readonly)

Returns the value of attribute max_attempts.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def max_attempts
  @max_attempts
end

#posterObject (readonly)

Returns the value of attribute poster.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def poster
  @poster
end

#statusObject (readonly)

Returns the value of attribute status.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def status
  @status
end

#submissionsObject (readonly)

Returns the value of attribute submissions.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def submissions
  @submissions
end

#taskObject (readonly) Also known as: task_description, description

Returns the value of attribute task.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def task
  @task
end

#validationObject (readonly)

Returns the value of attribute validation.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def validation
  @validation
end

#winnerObject (readonly)

Returns the value of attribute winner.



298
299
300
# File 'lib/remitmd/models.rb', line 298

def winner
  @winner
end