Module: Restiny::Api::Profile

Includes:
Base
Included in:
Restiny
Defined in:
lib/restiny/api/profile.rb

Instance Method Summary collapse

Methods included from Base

#get, #post

Instance Method Details

#get_character_profile(character_id:, membership_id:, membership_type:, components:) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/restiny/api/profile.rb', line 20

def get_character_profile(character_id:, membership_id:, membership_type:, components:)
  get_profile(
    membership_id: membership_id,
    membership_type: membership_type,
    components: components,
    type_url: "Character/#{character_id}/"
  )
end

#get_instanced_item_profile(item_id:, membership_id:, membership_type:, components:) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/restiny/api/profile.rb', line 29

def get_instanced_item_profile(item_id:, membership_id:, membership_type:, components:)
  get_profile(
    membership_id: membership_id,
    membership_type: membership_type,
    components: components,
    type_url: "Item/#{item_id}/"
  )
end

#get_profile(membership_id:, membership_type:, components:, type_url: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/restiny/api/profile.rb', line 10

def get_profile(membership_id:, membership_type:, components:, type_url: nil)
  raise Restiny::InvalidParamsError, 'No components provided' unless valid_array_param?(components)

  url = "/Destiny2/#{membership_type}/Profile/#{membership_id}/"
  url += type_url if type_url
  url += "?components=#{components.join(',')}"

  get(url)
end