Class: QuickBlox::User
- Inherits:
-
Object
- Object
- QuickBlox::User
- Defined in:
- lib/quick_blox/user.rb
Instance Attribute Summary collapse
-
#blob_id ⇒ Object
Returns the value of attribute blob_id.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#custom_data ⇒ Object
Returns the value of attribute custom_data.
-
#email ⇒ Object
Returns the value of attribute email.
-
#external_user_id ⇒ Object
Returns the value of attribute external_user_id.
-
#facebook_id ⇒ Object
Returns the value of attribute facebook_id.
-
#full_name ⇒ Object
Returns the value of attribute full_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_request_at ⇒ Object
Returns the value of attribute last_request_at.
-
#login ⇒ Object
Returns the value of attribute login.
-
#owner_id ⇒ Object
Returns the value of attribute owner_id.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#twitter_digits_id ⇒ Object
Returns the value of attribute twitter_digits_id.
-
#twitter_id ⇒ Object
Returns the value of attribute twitter_id.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#user_tags ⇒ Object
Returns the value of attribute user_tags.
-
#website ⇒ Object
Returns the value of attribute website.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#blob_id ⇒ Object
Returns the value of attribute blob_id.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def blob_id @blob_id end |
#created_at ⇒ Object
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def created_at @created_at end |
#custom_data ⇒ Object
Returns the value of attribute custom_data.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def custom_data @custom_data end |
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def email @email end |
#external_user_id ⇒ Object
Returns the value of attribute external_user_id.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def external_user_id @external_user_id end |
#facebook_id ⇒ Object
Returns the value of attribute facebook_id.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def facebook_id @facebook_id end |
#full_name ⇒ Object
Returns the value of attribute full_name.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def full_name @full_name end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def id @id end |
#last_request_at ⇒ Object
Returns the value of attribute last_request_at.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def last_request_at @last_request_at end |
#login ⇒ Object
Returns the value of attribute login.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def login @login end |
#owner_id ⇒ Object
Returns the value of attribute owner_id.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def owner_id @owner_id end |
#phone ⇒ Object
Returns the value of attribute phone.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def phone @phone end |
#twitter_digits_id ⇒ Object
Returns the value of attribute twitter_digits_id.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def twitter_digits_id @twitter_digits_id end |
#twitter_id ⇒ Object
Returns the value of attribute twitter_id.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def twitter_id @twitter_id end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def updated_at @updated_at end |
#user_tags ⇒ Object
Returns the value of attribute user_tags.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def @user_tags end |
#website ⇒ Object
Returns the value of attribute website.
4 5 6 |
# File 'lib/quick_blox/user.rb', line 4 def website @website end |
Class Method Details
.create(application_session, options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/quick_blox/user.rb', line 7 def self.create(application_session, ) raise QuickBlox::Exceptions::MissingConfiguration unless QuickBlox.configuration RestClient::Request.execute( method: :post, url: "#{ QuickBlox.configuration.host }/users.json", payload: { user: { login: [:login], password: [:password] } }.to_json, headers: { 'Content-Type': 'application/json', 'QuickBlox-REST-API-Version': QuickBlox.configuration.api_version, 'QB-Token': application_session.token } ){ |response, request, result| response = JSON.parse(response) case result.code.to_i when 201 instance = QuickBlox::User.new response['user'].each do |k, v| instance.instance_variable_set "@#{k}", v end return instance else raise QuickBlox::Exceptions::Response, response['errors'] end } end |
.show(application_session, user_id) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/quick_blox/user.rb', line 41 def self.show(application_session, user_id) RestClient::Request.execute( method: :get, url: "#{ QuickBlox.configuration.host }/users/#{ user_id }.json", headers: { 'QuickBlox-REST-API-Version': QuickBlox.configuration.api_version, 'QB-Token': application_session.token } ){ |response, request, result| response = JSON.parse(response) case result.code.to_i when 200 instance = QuickBlox::User.new response['user'].each do |k, v| instance.instance_variable_set "@#{k}", v end return instance when 404 raise QuickBlox::Exceptions::ResourceNotFound else raise QuickBlox::Exceptions::Response, response['errors'] end } end |
Instance Method Details
#destroy(application_session) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/quick_blox/user.rb', line 67 def destroy(application_session) RestClient::Request.execute( method: :delete, url: "#{ QuickBlox.configuration.host }/users/#{ self.id }.json", headers: { 'QuickBlox-REST-API-Version': QuickBlox.configuration.api_version, 'QB-Token': application_session.token } ){ |response, request, result| case result.code.to_i when 200 else response = JSON.parse(response) raise QuickBlox::Exceptions::Response, response['errors'] end } end |