Sha256: b248e2a940109118d160cb72f2fcef32952e68aec1f2ddcd83cdc09d87f421b5
Contents?: true
Size: 579 Bytes
Versions: 1
Compression:
Stored size: 579 Bytes
Contents
class Catarse::Calendar attr_accessor :api_key, :max_results CALENDAR_API_URL = "https://www.googleapis.com/calendar/v3/" def initialize(api_key=nil, max_results=4) @api_key = api_key if api_key @api_key = Catarse::Configuration[:google_api_key] @max_results = max_results end def fetch_events_from(calendar_id) req = HTTParty.get(CALENDAR_API_URL+"calendars/#{calendar_id}/events?key=#{@api_key}&maxResults=#{@max_results}") if req.code == 200 json = ActiveSupport::JSON.decode(req.body) return json['items'] end [] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
catarse_core-1.0.0.beta | lib/catarse/calendar.rb |