Class: Coinmarketcal::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/coinmarketcal/category.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Category

Returns a new instance of Category.



5
6
7
8
# File 'lib/coinmarketcal/category.rb', line 5

def initialize(attrs = {})
  @id = attrs['id']
  @name = attrs['name']
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/coinmarketcal/category.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/coinmarketcal/category.rb', line 3

def name
  @name
end

Class Method Details

.allObject



10
11
12
# File 'lib/coinmarketcal/category.rb', line 10

def self.all
  client.get('v1/categories').map{|data| new(data) }
end