Class: HackernewsApi::User

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ User

Returns a new instance of User.



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

def initialize json
  @id = json['id']
  @aobut = json['about']
  @create = json['created']
  @delay = json['delay']
  @karma = json['karma']
  @submitted = json['submitted']
end

Instance Attribute Details

#aboutObject (readonly)

Returns the value of attribute about.



7
8
9
# File 'lib/hackernews_api/user.rb', line 7

def about
  @about
end

#createdObject (readonly)

Returns the value of attribute created.



7
8
9
# File 'lib/hackernews_api/user.rb', line 7

def created
  @created
end

#delayObject (readonly)

Returns the value of attribute delay.



7
8
9
# File 'lib/hackernews_api/user.rb', line 7

def delay
  @delay
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/hackernews_api/user.rb', line 7

def id
  @id
end

#karmaObject (readonly)

Returns the value of attribute karma.



7
8
9
# File 'lib/hackernews_api/user.rb', line 7

def karma
  @karma
end

#submittedObject (readonly)

Returns the value of attribute submitted.



7
8
9
# File 'lib/hackernews_api/user.rb', line 7

def 
  @submitted
end

Class Method Details

.fetch(id) ⇒ Object



3
4
5
# File 'lib/hackernews_api/user.rb', line 3

def self.fetch id
  new(Client.fetch(:user, id))
end