class Aspose::Cloud::Tasks::Calendar
Public Class Methods
new(filename)
click to toggle source
# File lib/tasks/calendar.rb, line 5 def initialize(filename) @filename = filename raise 'filename not specified.' if filename.empty? @base_uri = Aspose::Cloud::Common::Product.product_uri + '/tasks/' + @filename end
Public Instance Methods
add_calendar(json_data, folder_name = '', storage_type = 'Aspose', storage_name = '')
click to toggle source
Add Calendar
to Project @param json json_data Provide data in json format.
# File lib/tasks/calendar.rb, line 38 def add_calendar(json_data, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'json_data not specified.' if json_data.empty? str_uri = "#{@base_uri}/calendars" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) json = JSON.parse(Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'POST','JSON',json_data)) json['Status'] == 'Created' ? json['CalendarItem'] : nil end
delete_calendar(calendar_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
click to toggle source
Delete a Calendar
from Project @param number calendar_id The id of the calendar.
# File lib/tasks/calendar.rb, line 52 def delete_calendar(calendar_id, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'calendar_id not specified.' if calendar_id.nil? str_uri = "#{@base_uri}/calendars/#{calendar_id}" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) json = JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'})) json['Code'] == 200 ? true : false end
get_calendar(calendar_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
click to toggle source
Get a Particular Calendar
form Project @param number calendar_id The id of the calendar.
# File lib/tasks/calendar.rb, line 25 def get_calendar(calendar_id, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'calendar_id not specified.' if calendar_id.nil? str_uri = "#{@base_uri}/calendars/#{calendar_id}" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Calendar'] end
get_calendars(folder_name = '', storage_type = 'Aspose', storage_name = '')
click to toggle source
Get all Calendars form Project
# File lib/tasks/calendar.rb, line 14 def get_calendars(folder_name = '', storage_type = 'Aspose', storage_name = '') str_uri = "#{@base_uri}/calendars" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Calendars']['List'] end