From a9514b39c9cdda83c6e8daf0d49a232233735d78 Mon Sep 17 00:00:00 2001 From: Charlie Jonas Date: Fri, 7 Dec 2018 21:26:19 +0000 Subject: [PATCH] Add diary functionality to venues & societies --- lib/camdram/organisation.rb | 10 ++++++++++ lib/camdram/venue.rb | 10 ++++++++++ lib/camdram/version.rb | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/camdram/organisation.rb b/lib/camdram/organisation.rb index 4d5da08..17f9051 100644 --- a/lib/camdram/organisation.rb +++ b/lib/camdram/organisation.rb @@ -3,6 +3,7 @@ require 'camdram/image' require 'camdram/news' require 'camdram/show' +require 'camdram/diary' module Camdram class Organisation < Base @@ -51,6 +52,15 @@ def shows split_object( response, Show ) end + # Gets a diary object which contains an array of upcoming calendar events for the organisation + # + # @return [Camdram::Diary] A Diary object. + def diary() + url = "#{self.class.url}/#{slug}/diary.json" + response = get(url) + Diary.new(response) + end + # Returns the URL+slug of the organisation # # @return [String] The full URL and slug. diff --git a/lib/camdram/venue.rb b/lib/camdram/venue.rb index bf5d359..b52fae3 100644 --- a/lib/camdram/venue.rb +++ b/lib/camdram/venue.rb @@ -2,6 +2,7 @@ require 'camdram/api' require 'camdram/news' require 'camdram/show' +require 'camdram/diary' module Camdram class Venue < Base @@ -45,6 +46,15 @@ def shows split_object( response, Show ) end + # Gets a diary object which contains an array of upcoming calendar events for the venue + # + # @return [Camdram::Diary] A Diary object. + def diary() + url = "#{self.class.url}/#{slug}/diary.json" + response = get(url) + Diary.new(response) + end + # Returns the URL+slug of the venue # # @return [String] The full URL and slug. diff --git a/lib/camdram/version.rb b/lib/camdram/version.rb index 732b552..0331afa 100644 --- a/lib/camdram/version.rb +++ b/lib/camdram/version.rb @@ -1,4 +1,4 @@ module Camdram - VERSION = '1.2.0' + VERSION = '1.2.1' BASE_URL = 'https://www.camdram.net' end