class GoogleR::Calendar
Attributes
description[RW]
etag[RW]
google_id[RW]
summary[RW]
time_zone[RW]
Public Class Methods
api_headers()
click to toggle source
# File lib/google_r/calendar.rb, line 10 def self.api_headers { 'GData-Version' => '3.0', 'Content-Type' => 'application/json', } end
from_json(json, *attrs)
click to toggle source
# File lib/google_r/calendar.rb, line 29 def self.from_json(json, *attrs) if json["kind"] == "calendar#calendar" || json["kind"] == "calendar#calendarListEntry" calendar = self.new calendar.google_id = json["id"] calendar.etag = json["etag"] calendar.summary = json["summary"] calendar.description = json["description"] calendar.time_zone = json["timeZone"] calendar else raise "Not implemented:\n#{json.inspect}" end end
path()
click to toggle source
# File lib/google_r/calendar.rb, line 17 def self.path "/calendar/v3/users/me/calendarList" end
url()
click to toggle source
# File lib/google_r/calendar.rb, line 6 def self.url "https://www.googleapis.com" end
Public Instance Methods
new?()
click to toggle source
# File lib/google_r/calendar.rb, line 55 def new? self.google_id.nil? end
path()
click to toggle source
# File lib/google_r/calendar.rb, line 21 def path if new? "/calendar/v3/calendars" else "/calendar/v3/calendars/#{google_id}" end end
to_google(yajl_opts = {})
click to toggle source
# File lib/google_r/calendar.rb, line 43 def to_google(yajl_opts = {}) hash = { "kind" => "calendar#calendar", } hash["etag"] = etag if etag hash["id"] = google_id if google_id hash["summary"] = summary if summary hash["description"] = description if description hash["timeZone"] = time_zone if time_zone Yajl::Encoder.encode(hash, yajl_opts) end