Class: Camdram::Venue

Inherits:
Base
  • Object
show all
Includes:
API, Refreshable
Defined in:
lib/camdram/venue.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Refreshable

#refresh!

Methods inherited from Base

#make_orphan

Constructor Details

#initialize(*args) ⇒ Camdram::Venue

Instantiate a new Venue object from a JSON hash

Parameters:

  • options (Hash)

    A single JSON hash with symbolized keys.


19
20
21
22
# File 'lib/camdram/venue.rb', line 19

def initialize(*args)
  super(*args)
  @image = Image.new(@image, @client_instance) unless @image.nil?
end

Instance Attribute Details

#addressObject

Returns the value of attribute address


13
14
15
# File 'lib/camdram/venue.rb', line 13

def address
  @address
end

#collegeObject

Returns the value of attribute college


13
14
15
# File 'lib/camdram/venue.rb', line 13

def college
  @college
end

#descriptionObject

Returns the value of attribute description


13
14
15
# File 'lib/camdram/venue.rb', line 13

def description
  @description
end

#facebook_idObject

Returns the value of attribute facebook_id


13
14
15
# File 'lib/camdram/venue.rb', line 13

def facebook_id
  @facebook_id
end

#imageObject

Returns the value of attribute image


13
14
15
# File 'lib/camdram/venue.rb', line 13

def image
  @image
end

#latitudeObject

Returns the value of attribute latitude


13
14
15
# File 'lib/camdram/venue.rb', line 13

def latitude
  @latitude
end

#longitudeObject

Returns the value of attribute longitude


13
14
15
# File 'lib/camdram/venue.rb', line 13

def longitude
  @longitude
end

#nameObject

Returns the value of attribute name


13
14
15
# File 'lib/camdram/venue.rb', line 13

def name
  @name
end

#short_nameObject

Returns the value of attribute short_name


13
14
15
# File 'lib/camdram/venue.rb', line 13

def short_name
  @short_name
end

#slugObject

Returns the value of attribute slug


13
14
15
# File 'lib/camdram/venue.rb', line 13

def slug
  @slug
end

#theme_colorObject

Returns the value of attribute theme_color


13
14
15
# File 'lib/camdram/venue.rb', line 13

def theme_color
  @theme_color
end

#twitter_idObject

Returns the value of attribute twitter_id


13
14
15
# File 'lib/camdram/venue.rb', line 13

def twitter_id
  @twitter_id
end

Class Method Details

.urlString

Returns the URL stub assocaited with all venues

Returns:

  • (String)

    The URL stub.


88
89
90
# File 'lib/camdram/venue.rb', line 88

def self.url
  '/venues'
end

Instance Method Details

#diary(from = nil, to = nil) ⇒ Camdram::Diary

Gets a diary object which contains an array of upcoming calendar events for the venue

Returns:


68
69
70
71
72
73
74
75
76
# File 'lib/camdram/venue.rb', line 68

def diary(from = nil, to = nil)
  url = "#{self.class.url}/#{slug}/diary.json"
  url += "?" if from || to
  url += "from=#{from}" if from
  url += "&" if from && to
  url += "to=#{to}" if to
  response = get(url)
  Diary.new(response, @client_instance)
end

#infoHash

Return a hash of the venue's attributes

Returns:

  • (Hash)

    Hash with symbolized keys.


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/camdram/venue.rb', line 27

def info
  {
    id: id,
    name: name,
    description: description,
    facebook_id: facebook_id,
    twitter_id: twitter_id,
    short_name: short_name,
    college: college,
    slug: slug,
    address: address,
    latitude: latitude,
    longitude: longitude,
  }
end

#newsArray

Gets an array of the venue's news items

Returns:

  • (Array)

    An array of News objects.


46
47
48
49
50
# File 'lib/camdram/venue.rb', line 46

def news
  url = "#{self.class.url}/#{slug}/news.json"
  response = get(url)
  split_object(response, News)
end

#shows(from = nil, to = nil) ⇒ Array

Gets an array of the venue's upcoming shows

Returns:

  • (Array)

    An array of Show objects.


55
56
57
58
59
60
61
62
63
# File 'lib/camdram/venue.rb', line 55

def shows(from = nil, to = nil)
  url = "#{self.class.url}/#{slug}/shows.json"
  url += "?" if from || to
  url += "from=#{from}" if from
  url += "&" if from && to
  url += "to=#{to}" if to
  response = get(url)
  split_object(response, Show)
end

#url_slugString

Returns the URL+slug of the venue

Returns:

  • (String)

    The full URL and slug.


81
82
83
# File 'lib/camdram/venue.rb', line 81

def url_slug
  "#{self.class.url}/#{slug}.json"
end