class Dirble::Category

Attributes

description[RW]
id[RW]
name[RW]

Public Class Methods

all() click to toggle source
# File lib/dirble/category.rb, line 13
def self.all
  call_api_with_results(
    request_type: :get,
    query: 'categories/apikey/{{api_key}}'
  )
end
find(category_id) click to toggle source
# File lib/dirble/category.rb, line 20
def self.find(category_id)
  all.select { |category| category.id == category_id }.first
end
first() click to toggle source
# File lib/dirble/category.rb, line 24
def self.first
  all.first
end
new(options) click to toggle source
# File lib/dirble/category.rb, line 7
def initialize(options)
  self.id = options[:id]
  self.name = options[:name]
  self.description = options[:description]
end
primary() click to toggle source
# File lib/dirble/category.rb, line 28
def self.primary
  call_api_with_results(
    request_type: :get,
    query: 'primaryCategories/apikey/{{api_key}}',
    factory_klass: Dirble::PrimaryCategory
  )
end

Public Instance Methods

primary() click to toggle source
# File lib/dirble/category.rb, line 44
def primary
  false
end
stations() click to toggle source
# File lib/dirble/category.rb, line 36
def stations
  self.class.call_api_with_results(
    request_type: :get,
    query: "stations/apikey/{{api_key}}/id/#{id}",
    factory_klass: Dirble::Station
  )
end