Sha256: 137bc3f75d3475a3769ba4f3e671abbe2865026e32768c775752623692f0c267

Contents?: true

Size: 584 Bytes

Versions: 13

Compression:

Stored size: 584 Bytes

Contents

require 'plaid/util'
module Plaid
  class Category
    include Plaid::Util

    attr_accessor(:type, :hierarchy, :id, :cat_array)

    def instantiate_all_categories(res)
      self.cat_array = []
      res.each do |cat|
        category = Category.new
        self.cat_array << category.build_category(cat)
      end
      self.cat_array
    end

    def instantiate_one_category(res)
      self.build_category(res)
      self
    end

    protected

    def build_category(cat)
      self.type = cat['type'], self.hierarchy = cat['hierarchy'], self.id = cat['id']
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
plaid-1.4.3 lib/plaid/category/category.rb
plaid-1.4.2 lib/plaid/category/category.rb
plaid-1.4.1 lib/plaid/category/category.rb
plaid-1.4.0 lib/plaid/category/category.rb
plaid-1.3.0 lib/plaid/category/category.rb
plaid-1.2.3 lib/plaid/category/category.rb
plaid-1.2.2 lib/plaid/category/category.rb
plaid-1.1.2 lib/plaid/category/category.rb
plaid-1.2.1 lib/plaid/category/category.rb
plaid-1.2.0 lib/plaid/category/category.rb
plaid-1.1.1 lib/plaid/category/category.rb
plaid-1.1.0 lib/plaid/category/category.rb
plaid-1.0.1 lib/plaid/category/category.rb