Class: OldPlaid::Category

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields = {}) ⇒ Category

Returns a new instance of Category.



5
6
7
8
9
# File 'lib/old_plaid/models/category.rb', line 5

def initialize(fields = {})
  @type = fields['type']
  @hierarchy = fields['hierarchy']
  @id = fields['id']
end

Instance Attribute Details

#hierarchyObject

Returns the value of attribute hierarchy.



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

def hierarchy
  @hierarchy
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Class Method Details

.all(res) ⇒ Object

API: semi-private This method takes an array returned from the API and instantiates all of the categories



13
14
15
# File 'lib/old_plaid/models/category.rb', line 13

def self.all(res)
  res.map { |cat| new(cat) }
end