Class: Powncer::User
- Inherits:
-
Base
- Object
- Base
- Powncer::User
show all
- Defined in:
- lib/powncer/user.rb
Constant Summary
Constants inherited
from Base
Base::FORMAT
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
extract_options, #id, instantiate, parse, #post, post, request, #request
Constructor Details
#initialize(*args) ⇒ User
Returns a new instance of User.
7
8
9
10
11
|
# File 'lib/powncer/user.rb', line 7
def initialize(*args)
attributes = (args)
@_username = args.first
@attributes = attributes
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Powncer::Base
Instance Attribute Details
#_username ⇒ Object
Returns the value of attribute _username.
5
6
7
|
# File 'lib/powncer/user.rb', line 5
def _username
@_username
end
|
Class Method Details
.find(username) ⇒ Object
64
65
66
67
68
|
# File 'lib/powncer/user.rb', line 64
def find(username)
url = "/users/#{username}.#{self.superclass::FORMAT}"
user = self.superclass.request(url)
instantiate(user)
end
|
.send_to ⇒ Object
70
71
72
73
|
# File 'lib/powncer/user.rb', line 70
def send_to
url = "/send/send_to.#{self.superclass::FORMAT}"
request(url)
end
|
Instance Method Details
#events ⇒ Object
53
54
55
56
|
# File 'lib/powncer/user.rb', line 53
def events
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?type=events"
request(url)["notes"].collect!{|note| Event.instantiate(note)}
end
|
#fan_of ⇒ Object
33
34
35
36
|
# File 'lib/powncer/user.rb', line 33
def fan_of
url = "/users/#{@_username || self.username}/fan_of.#{FORMAT}"
request(url)["fan_of"]["users"].collect!{|user| self.class.instantiate(user)}
end
|
#fans ⇒ Object
28
29
30
31
|
# File 'lib/powncer/user.rb', line 28
def fans
url = "/users/#{@_username || self.username}/fans.#{FORMAT}"
users = request(url)["fans"]["users"].collect!{|user| self.class.instantiate(user)}
end
|
#friends ⇒ Object
23
24
25
26
|
# File 'lib/powncer/user.rb', line 23
def friends
url = "/users/#{@_username || self.username}/friends.#{FORMAT}"
request(url)["friends"]["users"].collect!{|user| self.class.instantiate(user)}
end
|
#is_pro? ⇒ Boolean
13
14
15
|
# File 'lib/powncer/user.rb', line 13
def is_pro?
self.is_pro
end
|
#links ⇒ Object
48
49
50
51
|
# File 'lib/powncer/user.rb', line 48
def links
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?type=links"
request(url)["notes"].collect!{|note| Link.instantiate(note)}
end
|
#messages ⇒ Object
43
44
45
46
|
# File 'lib/powncer/user.rb', line 43
def messages
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?type=messages"
request(url)["notes"].collect!{|note| Note.instantiate(note)}
end
|
#notes ⇒ Object
38
39
40
41
|
# File 'lib/powncer/user.rb', line 38
def notes
url = "/note_lists/#{@_username || self.username}.#{FORMAT}?filter=notes"
request(url)["notes"].collect!{|note| Note.instantiate(note)}
end
|
#profile ⇒ Object
17
18
19
20
21
|
# File 'lib/powncer/user.rb', line 17
def profile
url = "/users/#{@_username}.#{FORMAT}"
user = request(url)
self.class.instantiate(user)
end
|
#send_to ⇒ Object
58
59
60
|
# File 'lib/powncer/user.rb', line 58
def send_to
self.class.send_to
end
|