Class: Gratitude::Profile

Inherits:
Object
  • Object
show all
Includes:
Connection
Defined in:
lib/gratitude/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Connection

#faraday

Constructor Details

#initialize(username) ⇒ Profile

Returns a new instance of Profile.



8
9
10
# File 'lib/gratitude/profile.rb', line 8

def initialize(username)
  @username = username
end

Instance Attribute Details

#usernameObject (readonly)

Returns the value of attribute username.



6
7
8
# File 'lib/gratitude/profile.rb', line 6

def username
  @username
end

Instance Method Details

#amount_receivingObject Also known as: receiving



32
33
34
# File 'lib/gratitude/profile.rb', line 32

def amount_receiving
  response_body.fetch("receiving").to_f
end

#bitcoinObject



41
42
43
# File 'lib/gratitude/profile.rb', line 41

def bitcoin
  response_body.fetch("bitcoin") { nil }
end

#givingObject Also known as: amount_giving



27
28
29
# File 'lib/gratitude/profile.rb', line 27

def giving
  response_body.fetch("giving").to_f
end

#goalObject



37
38
39
# File 'lib/gratitude/profile.rb', line 37

def goal
  response_body.fetch("goal").to_f if response_body["goal"]
end