Class: Iknow::User
Defined Under Namespace
Classes: Profile, Study
Constant Summary
collapse
- ATTRIBUTES =
[:username, :profile]
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
attributes, #attributes, deserialize, #deserialize
Constructor Details
#initialize(params) ⇒ User
Returns a new instance of User.
76
77
78
79
|
# File 'lib/iknow/model/user.rb', line 76
def initialize(params)
@profile = Profile.new(params[:profile])
@username = params[:username]
end
|
Class Method Details
.find(username, params = {}) ⇒ Object
64
65
66
67
68
|
# File 'lib/iknow/model/user.rb', line 64
def self.find(username, params = {})
params[:username] = username
hash = Iknow::RestClient::User.find(params)
self.deserialize(hash)
end
|
.matching(keyword, params = {}) ⇒ Object
70
71
72
73
74
|
# File 'lib/iknow/model/user.rb', line 70
def self.matching(keyword, params = {})
params[:keyword] = keyword
hash = Iknow::RestClient::User.matching(params)
self.deserialize(hash) || []
end
|
Instance Method Details
#friends(params = {}) ⇒ Object
91
92
93
94
|
# File 'lib/iknow/model/user.rb', line 91
def friends(params = {})
hash = Iknow::RestClient::User.friends(params.merge(:username => self.username))
self.deserialize(hash) || []
end
|
#items(params = {}) ⇒ Object
81
82
83
84
|
# File 'lib/iknow/model/user.rb', line 81
def items(params = {})
hash = Iknow::RestClient::User.items(params.merge(:username => self.username))
self.deserialize(hash, :as => Iknow::Item) || []
end
|
#lists(params = {}) ⇒ Object
86
87
88
89
|
# File 'lib/iknow/model/user.rb', line 86
def lists(params = {})
hash = Iknow::RestClient::User.lists(params.merge(:username => self.username))
self.deserialize(hash, :as => Iknow::List) || []
end
|
#study(params = {}) ⇒ Object
96
97
98
99
100
101
|
# File 'lib/iknow/model/user.rb', line 96
def study(params = {})
params[:application] ||= 'iknow'
return nil unless ['iknow', 'dictation', 'brainspeed', ].include?(params[:application])
hash = Iknow::RestClient::User.study_results(params.merge(:username => self.username))
self.deserialize(hash, :as => Iknow::User::Study)
end
|