Class: Ubidots::User
- Inherits:
-
Object
- Object
- Ubidots::User
- Defined in:
- lib/ubidots/user.rb
Instance Attribute Summary collapse
-
#blog ⇒ Object
readonly
Returns the value of attribute blog.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#datasources ⇒ Object
readonly
Returns the value of attribute datasources.
-
#followers ⇒ Object
readonly
Returns the value of attribute followers.
-
#following ⇒ Object
readonly
Returns the value of attribute following.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ User
constructor
A new instance of User.
- #primary_key ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ User
Returns a new instance of User.
8 9 10 11 12 13 |
# File 'lib/ubidots/user.rb', line 8 def initialize(params={}) @profile = params @profile.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#blog ⇒ Object (readonly)
Returns the value of attribute blog.
6 7 8 |
# File 'lib/ubidots/user.rb', line 6 def blog @blog end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/ubidots/user.rb', line 6 def created_at @created_at end |
#datasources ⇒ Object (readonly)
Returns the value of attribute datasources.
5 6 7 |
# File 'lib/ubidots/user.rb', line 5 def datasources @datasources end |
#followers ⇒ Object (readonly)
Returns the value of attribute followers.
5 6 7 |
# File 'lib/ubidots/user.rb', line 5 def followers @followers end |
#following ⇒ Object (readonly)
Returns the value of attribute following.
5 6 7 |
# File 'lib/ubidots/user.rb', line 5 def following @following end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
6 7 8 |
# File 'lib/ubidots/user.rb', line 6 def profile @profile end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/ubidots/user.rb', line 6 def username @username end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
5 6 7 |
# File 'lib/ubidots/user.rb', line 5 def variables @variables end |
Class Method Details
.find(username) ⇒ Object
15 16 17 18 19 |
# File 'lib/ubidots/user.rb', line 15 def self.find(username) data = UserService.retrieve(username) return nil if data.nil? User.new(data.merge( username: username )) end |
Instance Method Details
#primary_key ⇒ Object
25 26 27 |
# File 'lib/ubidots/user.rb', line 25 def primary_key username end |