Class: Beemo::User
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#profile_pics ⇒ Object
Returns the value of attribute profile_pics.
-
#uid ⇒ Object
Returns the value of attribute uid.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(data) ⇒ User
Returns a new instance of User.
6 7 8 9 10 11 12 |
# File 'lib/beemo/user.rb', line 6 def initialize(data) @name = data["name"] @location = data["location"] @uid = data["uri"].split("/").last @profile_pics = data["pictures"] @url = data["link"] end |
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
4 5 6 |
# File 'lib/beemo/user.rb', line 4 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/beemo/user.rb', line 4 def name @name end |
#profile_pics ⇒ Object
Returns the value of attribute profile_pics.
4 5 6 |
# File 'lib/beemo/user.rb', line 4 def profile_pics @profile_pics end |
#uid ⇒ Object
Returns the value of attribute uid.
4 5 6 |
# File 'lib/beemo/user.rb', line 4 def uid @uid end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/beemo/user.rb', line 4 def url @url end |
Class Method Details
.default_headers ⇒ Object
14 15 16 |
# File 'lib/beemo/user.rb', line 14 def self.default_headers {headers: {"Authorization" => "bearer #{Beemo.configuration[:access_token]}"}} end |
.search(query) ⇒ Object
23 24 25 26 27 |
# File 'lib/beemo/user.rb', line 23 def self.search(query) response = get("/users?query=#{query}", default_headers).body data = JSON.parse(response) data["data"].map {|d| new(d) } end |
.user_info(uid) ⇒ Object
18 19 20 21 |
# File 'lib/beemo/user.rb', line 18 def self.user_info(uid) response = get("/users/#{uid}", default_headers).body self.new JSON.parse(response) end |