lib/destiny_rb/item_explorer.rb
# 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.


(String/Symbol)

Either the numeric representation of a item type or a symbol of said item type.
( String / Symbol ) Either the numeric representation of a item type or a symbol of said item type .
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
      else type.is_a? Symbol
          requested_type = types.fetch(type, 0) 
      end
    end
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 else type . is_a? Symbol requested_type = types . fetch ( type , 0 ) end end
Item Explorer Item-Type definitions
Usage:
client.types(:armor)
client.types(2)
Item Explorer Item - Type definitions Usage : client . types ( : armor ) client . types ( 2 )
# Fetch type from hash, if type doesn't match return 'none' # Fetch type from hash, if type doesn't match return 0 for 'none'
type
<not_specific>