Class: Camdram::Search
Instance Attribute Summary collapse
-
#entity_type ⇒ Object
Returns the value of attribute entity_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#start_at ⇒ Object
Returns the value of attribute start_at.
Attributes included from API
Attributes inherited from Base
Instance Method Summary collapse
-
#entity ⇒ Object
Return the correct Ruby object referenced by the search entity.
-
#info ⇒ Hash
Return a hash of the search entity's attributes.
Methods included from API
Methods inherited from Base
Instance Attribute Details
#entity_type ⇒ Object
Returns the value of attribute entity_type.
11 12 13 |
# File 'lib/camdram/search.rb', line 11 def entity_type @entity_type end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/camdram/search.rb', line 11 def name @name end |
#rank ⇒ Object
Returns the value of attribute rank.
11 12 13 |
# File 'lib/camdram/search.rb', line 11 def rank @rank end |
#slug ⇒ Object
Returns the value of attribute slug.
11 12 13 |
# File 'lib/camdram/search.rb', line 11 def slug @slug end |
#start_at ⇒ Object
Returns the value of attribute start_at.
11 12 13 |
# File 'lib/camdram/search.rb', line 11 def start_at @start_at end |
Instance Method Details
#entity ⇒ Object
Return the correct Ruby object referenced by the search entity
16 17 18 19 20 21 22 23 24 25 26 |
# 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 ⇒ Hash
Return a hash of the search entity's attributes
31 32 33 34 35 36 37 38 39 40 |
# 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 |