Class: BungieSdk::Destiny2::Profile

Inherits:
ApiAgent
  • Object
show all
Defined in:
lib/bungie_sdk/profile.rb

Overview

Represents a Destiny2 profile

Constant Summary

Constants inherited from ApiAgent

ApiAgent::BASE_URI

Instance Attribute Summary

Attributes inherited from ApiAgent

#data

Instance Method Summary collapse

Methods inherited from ApiAgent

#delete, #get, #initialize, #post, #put, #request, #run

Constructor Details

This class inherits a constructor from BungieSdk::ApiAgent

Instance Method Details

#characters(components: [DestinyComponentType.Characters]) ⇒ Object



11
12
13
14
15
16
# File 'lib/bungie_sdk/profile.rb', line 11

def characters(components: [DestinyComponentType.Characters])
  characters = run(get(profile_url, params: { components: components.join(',') })).body
  characters['characters']['data'].map do |_, character|
    Character.new(character)
  end
end

#membership_idObject



20
21
22
# File 'lib/bungie_sdk/profile.rb', line 20

def membership_id
  data['profile']['data']['userInfo']['membershipId']
end

#membership_typeObject



26
27
28
# File 'lib/bungie_sdk/profile.rb', line 26

def membership_type
  data['profile']['data']['userInfo']['membershipType']
end