class Doconomy::Api::Category
Attributes
id[RW]
main_category[RW]
sub_category[RW]
Public Class Methods
all()
click to toggle source
Get all categories
@return [Array<Doconomy::Api::Category>]
# File lib/doconomy/api/category.rb, line 20 def all response = client.get("/aland-index/#{Doconomy::Api.configuration.api_version}/categories") response[:categories].map { |attributes| new(attributes) } end
find(id)
click to toggle source
Get a category with the given ID
@return [Doconomy::Api::Category]
# File lib/doconomy/api/category.rb, line 29 def find(id) new(client.get("/aland-index/#{Doconomy::Api.configuration.api_version}/categories/#{id}")) end
new(attributes = {})
click to toggle source
# File lib/doconomy/api/category.rb, line 8 def initialize(attributes = {}) @attributes = attributes.deep_symbolize_keys @id = @attributes[:id] @main_category = OpenStruct.new(@attributes[:main_category]) if @attributes[:main_category] @sub_category = OpenStruct.new(@attributes[:sub_category]) if @attributes[:sub_category] end