Module: Destiny::ItemExplorer

Included in:
Client
Defined in:
lib/destiny_rb/item_explorer.rb

Instance Method Summary collapse

Instance Method Details

#buckets(type) ⇒ Object

Explorer Bucket definitions

Usage:

client.buckets(:artifact)
client.buckets(1)

Arguments:

type: (String/Symbol)

Returns:

Either the numeric representation of a explorer bucket or a symbol of said bucket.


147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/destiny_rb/item_explorer.rb', line 147

def buckets(type)
  types = {
    none: 0,
    artifact: 1,
    materials: 2,
    consumables: 4,
    mission: 8,
    bounties: 16,
    build: 32,
    primary_weapon: 64,
    special_weapon: 128,
    heavy_weapon: 256,
    head: 512,
    arms: 1024,
    chest: 2048,
    legs: 4096,
    class_items: 8192,
    ghost: 16384,
    vehicle: 32768,
    ship: 65536,
    shader: 131072,
    emblem: 262144
    }
  if type.is_a? Numeric
      requested_type = types.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
  else type.is_a? Symbol
      requested_type = types.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
  end
end

#get_exlorer_items(options = {}) ⇒ Object



177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/destiny_rb/item_explorer.rb', line 177

def get_exlorer_items(options={})
  definitions = options[:definitions] || false
  character_class = character_class(options[:character_class] || 'unknown')
  types = types(options[:types] || 'none')
  sub_type = sub_type(options[:sub_type] || 'none')
  order = order(options[:order] || 'none')
  rarity = rarity(options[:rarity] || 'none')
  buckets = buckets(options[:buckets] || 'none')
  page = options[:page] || 0
  count = options[:count] || 250
  self.class.get("/Explorer/Items/?definitions=#{definitions}&count=#{count}&characterClass=#{character_class}&types=#{types}&subtype=#{sub_type}&order=#{order}&rarity=#{rarity}&buckets=#{buckets}&page=#{page}", headers: @headers)
end

#order(type) ⇒ Object

Item Explorer Ordering definitions

Usage:

client.order(:rarity)
client.enemy_race(3)

Arguments:

type: (String/Symbol)

Returns:

Either the numeric representation of a item ordering or a symbol of said ordering.


90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/destiny_rb/item_explorer.rb', line 90

def order(type)
  types = {
    none: 0,
    name: 1,
    item_type: 2,
    rarity: 3,
    item_type_name: 4,
    item_stat_hash: 5,
    minimum_required_level: 6,
    maximum_required_level: 7
    }
  if type.is_a? Numeric
      requested_type = types.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
  else type.is_a? Symbol
      requested_type = types.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
  end
end

#rarity(type) ⇒ Object

Item Explorer Rarity definitions

Usage:

client.enemy_race(:vex)
client.enemy_race(711470098)

Arguments:

type: (String/Symbol)

Returns:

Either the numeric representation of a enemy race or a symbol of said race.


119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/destiny_rb/item_explorer.rb', line 119

def rarity(type)
  types = {
    none: 0,
    currency: 1,
    basic: 2,
    common: 3,
    rare: 4,
    superior: 5,
    exotic: 6
    }
  if type.is_a? Numeric
      requested_type = types.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
  else type.is_a? Symbol
      requested_type = types.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
  end
end

#sub_type(type) ⇒ Object

Item Explorer Sub-Type definitions

Usage:

client.sub_type(:sidearm)
client.sub_type(17)

Arguments:

type: (String/Symbol)

Returns:

Either the numeric representation of a item sub-type or a symbol of said sub-type.


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/destiny_rb/item_explorer.rb', line 51

def sub_type(type)
  types = {
    none: 0,
    crucible: 1,
    vanguard: 2,
    iron_banner: 3,
    queen: 4,
    exotic: 5,
    auto_rifle: 6,
    shotgun: 7,
    machinegun: 8,
    hand_cannon: 9,
    rocket_launcher: 10,
    fusion_rifle: 11,
    sniper_rifle:12,
    pulse_rifle: 13,
    scout_rifle: 14,
    camera: 15,
    crm: 16,
    sidearm: 17
    }
  if type.is_a? Numeric
      requested_type = types.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
  else type.is_a? Symbol
      requested_type = types.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
  end
end

#types(type) ⇒ Object

Item Explorer Item-Type definitions

Usage:

client.types(:armor)
client.types(2)

Arguments:

type: (String/Symbol)

Returns:

Either the numeric representation of a item type or a symbol of said item type.


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/destiny_rb/item_explorer.rb', line 15

def types(type)
  types = {
    none: 0,
    currency: 1,
    armor: 2,
    weapon: 3,
    bounty: 4,
    completed_bounty: 5,
    bounty_reward: 6,
    message: 7,
    engram: 8,
    consumable: 9,
    exchange_material: 10,
    mission_reward: 11,
    quest_step: 12,
    quest_step_complete: 13
    }
  if type.is_a? Numeric
      requested_type = types.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
  else type.is_a? Symbol
      requested_type = types.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
  end
end