Class: Destiny::Account
- Inherits:
-
Object
- Object
- Destiny::Account
- Defined in:
- lib/destiny/account.rb
Overview
The Destiny::Account class is for acceessing information about a user’s account via the Destiny API
Instance Method Summary collapse
-
#details(membership_type, username) ⇒ Hash
- Deprecated
-
Returns Destiny account information for the supplied membership.
-
#initialize(client) ⇒ Account
constructor
A new instance of Account.
-
#items(membership_type, username) ⇒ Hash
Returns information about all items for the supplied Destiny Membership ID and a minimal set of character information so that it can be used.
-
#membership_id_from_display_name(membership_type, display_name) ⇒ Hash
Returns the numerical id of a player based on their display name, zero if not found.
-
#search_destiny_player(membership_type, display_name) ⇒ Hash
Returns a list of Destiny memberships given a full Gamertag or PSN ID.
-
#stats(membership_type, username) ⇒ Hash
Gets aggregate historical stats organized around each character for a given account.
-
#summary(membership_type, username) ⇒ Hash
Returns Destiny account information for the supplied membership in a compact summary form.
Constructor Details
#initialize(client) ⇒ Account
Returns a new instance of Account.
7 8 9 10 |
# File 'lib/destiny/account.rb', line 7 def initialize(client) @client = client @membership_id = nil end |
Instance Method Details
#details(membership_type, username) ⇒ Hash
- Deprecated
-
Returns Destiny account information for the supplied
membership. This endpoint has been deprecated. Please use ‘summary` instead, pretty please with sugar on top. Seriously, we’ll be BFFs 4 evah. Plus you can get at vault info without being logged in as that person, how cool is that?
21 22 23 24 25 26 27 |
# File 'lib/destiny/account.rb', line 21 def details(membership_type, username) num_membership_type = find_membership_type_from membership_type membership_id_from_display_name num_membership_type, username if @membership_id.nil? response = @client.get "Destiny/#{num_membership_type}/Account/"\ "#{@membership_id}" Destiny::Client.validate response end |
#items(membership_type, username) ⇒ Hash
Returns information about all items for the supplied Destiny Membership ID and a minimal set of character information so that it can be used.
35 36 37 38 39 40 41 |
# File 'lib/destiny/account.rb', line 35 def items(membership_type, username) num_membership_type = find_membership_type_from membership_type membership_id_from_display_name num_membership_type, username if @membership_id.nil? response = @client.get "Destiny/#{num_membership_type}/Account/"\ "#{@membership_id}/Items" Destiny::Client.validate response end |
#membership_id_from_display_name(membership_type, display_name) ⇒ Hash
Returns the numerical id of a player based on their display name, zero if not found.
49 50 51 52 53 54 55 56 57 |
# File 'lib/destiny/account.rb', line 49 def membership_id_from_display_name(membership_type, display_name) num_membership_type = find_membership_type_from membership_type response = @client.get "Destiny/#{num_membership_type}/Stats/"\ "GetMembershipIdByDisplayName/#{display_name}" response = Destiny::Client.validate response @membership_id ||= response['Response'] response end |
#search_destiny_player(membership_type, display_name) ⇒ Hash
Returns a list of Destiny memberships given a full Gamertag or PSN ID
64 65 66 67 68 69 70 71 72 |
# File 'lib/destiny/account.rb', line 64 def search_destiny_player(membership_type, display_name) num_membership_type = find_membership_type_from membership_type response = @client.get "Destiny/SearchDestinyPlayer/#{num_membership_type}"\ "/#{display_name}" response = Destiny::Client.validate response @membership_id ||= response['Response'][0]['membershipId'] response end |
#stats(membership_type, username) ⇒ Hash
Gets aggregate historical stats organized around each character for a given account.
96 97 98 99 100 101 102 |
# File 'lib/destiny/account.rb', line 96 def stats(membership_type, username) num_membership_type = find_membership_type_from membership_type membership_id_from_display_name num_membership_type, username if @membership_id.nil? response = @client.get "Destiny/Stats/Account/#{num_membership_type}/"\ "#{@membership_id}" Destiny::Client.validate response end |
#summary(membership_type, username) ⇒ Hash
Returns Destiny account information for the supplied membership in a compact summary form. Will return vault information even if you’re not that account. Don’t you want to be a cool kid and use this service instead of GetAccount?
82 83 84 85 86 87 88 |
# File 'lib/destiny/account.rb', line 82 def summary(membership_type, username) num_membership_type = find_membership_type_from membership_type membership_id_from_display_name num_membership_type, username if @membership_id.nil? response = @client.get "Destiny/#{num_membership_type}/Account/"\ "#{@membership_id}/Summary" Destiny::Client.validate response end |