Class: BackpackTF::UserListing

Inherits:
Response
  • Object
show all
Defined in:
lib/backpack_tf/user_listing.rb

Constant Summary collapse

INTERFACE =
:IGetUserListings
@@listings =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Response

hash_keys_to_sym, responses, to_sym

Constructor Details

#initialize(attr) ⇒ UserListing

Returns a new instance of UserListing.



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/backpack_tf/user_listing.rb', line 33

def initialize attr
  attr = check_attr_keys(attr)

  @id = attr[:id].to_sym
  @bump = attr[:bump]
  @created = attr[:created]
  @currencies = attr[:currencies]
  @item = set_keys_of_key_to_symbols(attr[:item], 'attributes')
  @details = attr[:details]
  @meta = self.class.hash_keys_to_sym(attr[:meta])
  @buyout = attr[:buyout]
end

Instance Attribute Details

#bumpObject (readonly)

Returns the value of attribute bump.



25
26
27
# File 'lib/backpack_tf/user_listing.rb', line 25

def bump
  @bump
end

#buyoutObject (readonly)

Returns the value of attribute buyout.



31
32
33
# File 'lib/backpack_tf/user_listing.rb', line 31

def buyout
  @buyout
end

#createdObject (readonly)

Returns the value of attribute created.



26
27
28
# File 'lib/backpack_tf/user_listing.rb', line 26

def created
  @created
end

#currenciesObject (readonly)

Returns the value of attribute currencies.



27
28
29
# File 'lib/backpack_tf/user_listing.rb', line 27

def currencies
  @currencies
end

#detailsObject (readonly)

Returns the value of attribute details.



29
30
31
# File 'lib/backpack_tf/user_listing.rb', line 29

def details
  @details
end

#idObject (readonly)

Returns the value of attribute id.



24
25
26
# File 'lib/backpack_tf/user_listing.rb', line 24

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



28
29
30
# File 'lib/backpack_tf/user_listing.rb', line 28

def item
  @item
end

#metaObject (readonly)

Returns the value of attribute meta.



30
31
32
# File 'lib/backpack_tf/user_listing.rb', line 30

def meta
  @meta
end

Class Method Details

.interfaceObject



10
# File 'lib/backpack_tf/user_listing.rb', line 10

def self.interface; @interface; end

.listingsObject



16
17
18
19
20
21
22
# File 'lib/backpack_tf/user_listing.rb', line 16

def self.listings
  return @response if response.nil?
  @@listings = response[:listings].inject([]) do |listings, attr|
    listings << new(attr)
    listings
  end
end

.responseObject



12
13
14
# File 'lib/backpack_tf/user_listing.rb', line 12

def self.response
  @response = superclass.responses[to_sym]
end