Class: Camdram::Organisation
- Includes:
- API
- Defined in:
- lib/camdram/organisation.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#facebook_id ⇒ Object
Returns the value of attribute facebook_id.
-
#image ⇒ Object
Returns the value of attribute image.
-
#name ⇒ Object
Returns the value of attribute name.
-
#short_name ⇒ Object
Returns the value of attribute short_name.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#twitter_id ⇒ Object
Returns the value of attribute twitter_id.
Attributes included from API
Attributes inherited from Base
Class Method Summary collapse
-
.url ⇒ String
Returns the URL stub assocaited with all organisations.
Instance Method Summary collapse
-
#diary ⇒ Camdram::Diary
Gets a diary object which contains an array of upcoming calendar events for the organisation.
-
#info ⇒ Hash
Return a hash of the organisation's attributes.
-
#initialize(options = {}) ⇒ Camdram::Organisation
constructor
Instantiate a new Organisation object from a JSON hash.
-
#news ⇒ Array
Gets an array of the organisation's news items.
-
#shows ⇒ Array
Gets an array of the organisation's upcoming shows.
-
#url_slug ⇒ String
Returns the URL+slug of the organisation.
Methods included from API
Constructor Details
#initialize(options = {}) ⇒ Camdram::Organisation
Instantiate a new Organisation object from a JSON hash
17 18 19 20 |
# File 'lib/camdram/organisation.rb', line 17 def initialize( = {}) super() @image = Image.new( @image ) unless @image.nil? end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/camdram/organisation.rb', line 11 def description @description end |
#facebook_id ⇒ Object
Returns the value of attribute facebook_id.
11 12 13 |
# File 'lib/camdram/organisation.rb', line 11 def facebook_id @facebook_id end |
#image ⇒ Object
Returns the value of attribute image.
11 12 13 |
# File 'lib/camdram/organisation.rb', line 11 def image @image end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/camdram/organisation.rb', line 11 def name @name end |
#short_name ⇒ Object
Returns the value of attribute short_name.
11 12 13 |
# File 'lib/camdram/organisation.rb', line 11 def short_name @short_name end |
#slug ⇒ Object
Returns the value of attribute slug.
11 12 13 |
# File 'lib/camdram/organisation.rb', line 11 def slug @slug end |
#twitter_id ⇒ Object
Returns the value of attribute twitter_id.
11 12 13 |
# File 'lib/camdram/organisation.rb', line 11 def twitter_id @twitter_id end |
Class Method Details
.url ⇒ String
Returns the URL stub assocaited with all organisations
74 75 76 |
# File 'lib/camdram/organisation.rb', line 74 def self.url '/societies' end |
Instance Method Details
#diary ⇒ Camdram::Diary
Gets a diary object which contains an array of upcoming calendar events for the organisation
58 59 60 61 62 |
# File 'lib/camdram/organisation.rb', line 58 def diary() url = "#{self.class.url}/#{slug}/diary.json" response = get(url) Diary.new(response) end |
#info ⇒ Hash
Return a hash of the organisation's attributes
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/camdram/organisation.rb', line 25 def info { id: id, name: name, description: description, facebook_id: facebook_id, twitter_id: twitter_id, short_name: short_name, slug: slug, } end |
#news ⇒ Array
Gets an array of the organisation's news items
40 41 42 43 44 |
# File 'lib/camdram/organisation.rb', line 40 def news news_url = "#{self.class.url}/#{slug}/news.json" response = get(news_url) split_object( response, News ) end |
#shows ⇒ Array
Gets an array of the organisation's upcoming shows
49 50 51 52 53 |
# File 'lib/camdram/organisation.rb', line 49 def shows shows_url = "#{self.class.url}/#{slug}/shows.json" response = get(shows_url) split_object( response, Show ) end |
#url_slug ⇒ String
Returns the URL+slug of the organisation
67 68 69 |
# File 'lib/camdram/organisation.rb', line 67 def url_slug "#{self.class.url}/#{slug}.json" end |