Class: Chiketto::Category

Inherits:
Resource show all
Defined in:
lib/chiketto/category.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Class Method Summary collapse

Methods inherited from Resource

build_query_string, endpoint, get, #initialize, open_post, paginated, post, should_paginate, token

Methods included from AttrDSL

included

Constructor Details

This class inherits a constructor from Chiketto::Resource

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#resource_uriObject

Returns the value of attribute resource_uri.



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

def resource_uri
  @resource_uri
end

#short_nameObject

Returns the value of attribute short_name.



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

def short_name
  @short_name
end

Class Method Details

.find(id) ⇒ Object



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

def self.find(id)
  response = get "categories/#{id}"
  new response.to_h
end

.listObject



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

def self.list
  categories = get 'categories'
  categories['categories'].map { |cat| Chiketto::Category.new cat }
end