Class: Gumroad::User

Inherits:
Object
  • Object
show all
Defined in:
lib/gumroad/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ User

Returns a new instance of User.



10
11
12
13
14
15
# File 'lib/gumroad/user.rb', line 10

def initialize(attrs)
  @name = attrs['name']
  @id = attrs['id']
  @bio = attrs['bio']
  @email = attrs['email']
end

Instance Attribute Details

#bioObject (readonly)

Returns the value of attribute bio.



8
9
10
# File 'lib/gumroad/user.rb', line 8

def bio
  @bio
end

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/gumroad/user.rb', line 8

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/gumroad/user.rb', line 8

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/gumroad/user.rb', line 8

def name
  @name
end

Class Method Details

.getObject



17
18
19
20
21
# File 'lib/gumroad/user.rb', line 17

def self.get
  response = Faraday.get("#{API_ROOT}", {'access_token' => Gumroad.token})
  attrs = JSON.parse(response.body)
  new(attrs['user'])
end