Class: User

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ User

Returns a new instance of User.



5
6
7
8
9
10
# File 'lib/nanotwitter/user.rb', line 5

def initialize(response)
  @name = response['name']
  @id = response['id']
  @tweets = make_tweets(response['tweets'])
  @timeline = make_tweets(response['timeline'])
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



16
17
18
# File 'lib/nanotwitter/user.rb', line 16

def id
  @id
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/nanotwitter/user.rb', line 16

def name
  @name
end

#timelineObject

Returns the value of attribute timeline.



16
17
18
# File 'lib/nanotwitter/user.rb', line 16

def timeline
  @timeline
end

#tweetsObject

Returns the value of attribute tweets.



16
17
18
# File 'lib/nanotwitter/user.rb', line 16

def tweets
  @tweets
end

Instance Method Details

#make_tweets(tweets) ⇒ Object



12
13
14
# File 'lib/nanotwitter/user.rb', line 12

def make_tweets(tweets)
  tweets.each {|tweet| Tweet.new(tweet)}
end