Class: Genius::Account

Inherits:
Resource show all
Defined in:
lib/genius/account.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#raw_response, #resource

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

default_headers, default_params, from_hash, handle_response, http_delete, http_get, http_post, http_put, #initialize, resource_name

Constructor Details

This class inherits a constructor from Genius::Resource

Instance Attribute Details

#about_meObject (readonly)

Returns the value of attribute about_me.



5
6
7
# File 'lib/genius/account.rb', line 5

def about_me
  @about_me
end

#artistObject (readonly)

Returns the value of attribute artist.



5
6
7
# File 'lib/genius/account.rb', line 5

def artist
  @artist
end

#avatarObject (readonly)

Returns the value of attribute avatar.



5
6
7
# File 'lib/genius/account.rb', line 5

def avatar
  @avatar
end

#current_user_metadataObject (readonly)

Returns the value of attribute current_user_metadata.



5
6
7
# File 'lib/genius/account.rb', line 5

def 
  @current_user_metadata
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/genius/account.rb', line 5

def id
  @id
end

#iqObject (readonly)

Returns the value of attribute iq.



5
6
7
# File 'lib/genius/account.rb', line 5

def iq
  @iq
end

#loginObject (readonly)

Returns the value of attribute login.



5
6
7
# File 'lib/genius/account.rb', line 5

def 
  @login
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/genius/account.rb', line 5

def name
  @name
end

#role_for_displayObject (readonly)

Returns the value of attribute role_for_display.



5
6
7
# File 'lib/genius/account.rb', line 5

def role_for_display
  @role_for_display
end

#tracking_pathsObject (readonly)

Returns the value of attribute tracking_paths.



5
6
7
# File 'lib/genius/account.rb', line 5

def tracking_paths
  @tracking_paths
end

#unread_main_activity_inbox_countObject (readonly)

Returns the value of attribute unread_main_activity_inbox_count.



5
6
7
# File 'lib/genius/account.rb', line 5

def unread_main_activity_inbox_count
  @unread_main_activity_inbox_count
end

#unread_messages_countObject (readonly)

Returns the value of attribute unread_messages_count.



5
6
7
# File 'lib/genius/account.rb', line 5

def unread_messages_count
  @unread_messages_count
end

Class Method Details

.findObject

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/genius/account.rb', line 29

def self.find(*)
  raise NotImplementedError, "An Account cannot be loaded by its ID in the public API"
end

.me(params = {}) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/genius/account.rb', line 33

def self.me(params = {})
  headers = default_headers.merge(params.delete(:headers) || {})
  params = default_params.merge(params)

  new(http_get("/account", query: params,
                           headers: headers),
      text_format: params[:text_format])
end

Instance Method Details

#parse_resource!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/genius/account.rb', line 9

def parse_resource!
  @unread_messages_count = resource["unread_messages_count"]
  @artist = resource["artist"]
  @role_for_display = resource["role_for_display"]
  @unread_main_activity_inbox_count = resource["unread_main_activity_inbox_count"]
  @avatar = resource["avatar"]
  @about_me = formatted_attribute("about_me")
  @identities = resource["identities"]
  @name = resource["name"]
  @tracking_paths = resource["tracking_paths"]
  @id = resource["id"]
  @current_user_metadata = resource["current_user_metadata"]
  @iq = resource["iq"]
  @login = resource["login"]
end

#reloadObject

Raises:



25
26
27
# File 'lib/genius/account.rb', line 25

def reload
  raise NotReloadableError, "An Account cannot be reloaded"
end