class Camdram::Search

Attributes

entity_type[RW]
name[RW]
rank[RW]
slug[RW]
start_at[RW]

Public Instance Methods

entity() click to toggle source

Return the correct Ruby object referenced by the search entity

@return [Object] The Ruby object that is referenced by the search entity.

# File lib/camdram/search.rb, line 16
def entity
  klass = case entity_type
    when "show" then Show
    when "society" then Organisation
    when "venue" then Venue
    when "person" then Person
  end
  url = "#{klass.url}/#{slug}.json"
  response = get(url)
  return klass.new(response)
end
info() click to toggle source

Return a hash of the search entity's attributes

@return [Hash] Hash with symbolized keys.

# File lib/camdram/search.rb, line 31
def info
  {
    name: name,
    slug: slug,
    start_at: start_at,
    rank: rank,
    id: id,
    entity_type: entity_type,
  }
end