Module: LittleLight::User

Included in:
Client
Defined in:
lib/little_light/user.rb

Instance Method Summary collapse

Instance Method Details

#get_bungie_net_profile(bungieMembershipId) ⇒ Object



3
4
5
6
7
8
# File 'lib/little_light/user.rb', line 3

def get_bungie_net_profile(bungieMembershipId)
  data = self.class.get(
    "/User/GetBungieNetUserById/#{bungieMembershipId}/",
     headers: @headers
   )
end

#get_character(destinyMembershipId, membershipType, characterId, component) ⇒ Object

only 200 query strings will produce results here for query strings that return a JSON object that has a key of privacy pointing to 2 - means that user need to be authenticated via OAuth 2.0 or user has privacy settings on. No real plans to implement OAuth in this gem.



104
105
106
107
108
109
110
# File 'lib/little_light/user.rb', line 104

def get_character(destinyMembershipId, membershipType, characterId, component)
  data = self.class.get(
    "/Destiny2/#{membershipType}/Profile/#{destinyMembershipId}"\
    "/Character/#{characterId}?components=#{component}",
     headers: @headers
   )
end

#get_current_user_membershipObject

returns the same as the method above, doesn’t require any parms to be passed in but does require a user to be signed in via Oauth2



42
43
44
45
46
47
# File 'lib/little_light/user.rb', line 42

def get_current_user_membership
  data = self.class.get(
    "/User/GetMembershipsForCurrentUser/",
    headers: @headers
  )
end

#get_destiny_profile(destinyMembershipId, membershipType, component) ⇒ Object

only 100 & 200 query strings will produce results here



90
91
92
93
94
95
96
# File 'lib/little_light/user.rb', line 90

def get_destiny_profile(destinyMembershipId, membershipType, component)
  data = self.class.get(
    "/Destiny2/#{membershipType}/Profile/#{destinyMembershipId}"\
    "?components=#{component}",
     headers: @headers
   )
end

#get_groups_for_user(destinyMembershipId, membershipType, groupType, filter) ⇒ Object

groupType 0 - general, 1 - clan filter 0 - All, 1 - Founded, 2 - Not Founded



77
78
79
80
81
82
83
# File 'lib/little_light/user.rb', line 77

def get_groups_for_user(destinyMembershipId, membershipType, groupType, filter)
  data = self.class.get(
    "/GroupV2/User/#{membershipType}/#{destinyMembershipId}"\
    "/#{filter}/#{groupType}/",
     headers: @headers
   )
end

#get_item(destinyMembershipId, membershipType, itemInstanceId) ⇒ Object

returns the stats of a specific item instance



113
114
115
116
117
118
119
# File 'lib/little_light/user.rb', line 113

def get_item(destinyMembershipId, membershipType, itemInstanceId)
  data = self.class.get(
    "/Destiny2/{membershipType}/Profile/{destinyMembershipId}/Item/"\
    "{itemInstanceId}/",
    headers: @headers
  )
end

#get_linked_profiles(destinyMembershipId, membershipType) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/little_light/user.rb', line 66

def get_linked_profiles(destinyMembershipId, membershipType)
  data = self.class.get(
    "/Destiny2/#{membershipType}/Profile/#{destinyMembershipId}"\
    "/LinkedProfiles/",
     headers: @headers
   )
end

#get_user_by_membership(destinyMembershipId, membershipType) ⇒ Object

basically returns a combination of both search_bungie_net_by_username && search_destiny_player however the destinyMembershipId is needed to access this endpoint (which you can only really get from search_destiny_player)



33
34
35
36
37
38
# File 'lib/little_light/user.rb', line 33

def get_user_by_membership(destinyMembershipId, membershipType)
  data = self.class.get(
    "/User/GetMembershipsById/#{destinyMembershipId}/#{membershipType}/",
     headers: @headers
   )
end

#get_user_clan_avatarObject



131
132
133
134
135
136
# File 'lib/little_light/user.rb', line 131

def get_user_clan_avatar
  data = self.class.get(
    "/GroupV2/GetAvailableAvatars/",
    headers: @headers
  )
end

#get_user_clan_themeObject

the next two get_user methods return info relevant to the specific clans they’re in but are user methods not clan methods



123
124
125
126
127
128
# File 'lib/little_light/user.rb', line 123

def get_user_clan_theme
  data = self.class.get(
    "/GroupV2/GetAvailableThemes/",
    headers: @headers
  )
end

#get_user_partnerships(destinyMembershipId) ⇒ Object



58
59
60
61
62
63
# File 'lib/little_light/user.rb', line 58

def get_user_partnerships(destinyMembershipId)
  data = self.class.get(
    "/User/#{destinyMembershipId}/Partnerships/",
    headers: @headers
   )
end

#get_user_themesObject



50
51
52
53
54
55
# File 'lib/little_light/user.rb', line 50

def get_user_themes
  data = self.class.get(
    "/User/GetAvailableThemes/",
    headers: @headers
  )
end

#search_bungie_net_by_username(username) ⇒ Object

returns a JSON object of potential users that match the given username gives basic overview of returned users, returns bungie.net membershipID but no Destiny membershipID



13
14
15
16
17
18
# File 'lib/little_light/user.rb', line 13

def search_bungie_net_by_username(username)
  data = self.class.get(
    "/User/SearchUsers?q=#{username}",
     headers: @headers
   )
end

#search_destiny_player(displayName, membershipType) ⇒ Object

returns only the exact user on the given platform or nothing basically just gives the Destiny membershipID displayName is either GamerTag or PSN Name



24
25
26
27
28
29
# File 'lib/little_light/user.rb', line 24

def search_destiny_player(displayName, membershipType)
  data = self.class.get(
    "/Destiny2/SearchDestinyPlayer/#{membershipType}/#{displayName}/",
     headers: @headers
   )
end