class ZohoHub::Notifications
Constants
- DEFAULT_PAGE
Default page number when fetching all.
- DEFAULT_RECORDS_PER_PAGE
Default number of records when fetching all.
- MIN_RECORDS
Minimum number of records to fetch when fetching all.
Public Class Methods
all(params = {})
click to toggle source
# File lib/zoho_hub/notifications.rb, line 24 def all(params = {}) params[:page] ||= DEFAULT_PAGE params[:per_page] ||= DEFAULT_RECORDS_PER_PAGE params[:per_page] = MIN_RECORDS if params[:per_page] < MIN_RECORDS body = get(request_path, params) return [] if body.nil? build_response(body) end
build_response(body)
click to toggle source
# File lib/zoho_hub/notifications.rb, line 44 def build_response(body) response = Response.new(body) raise RecordInvalid, response.msg if response.invalid_data? raise MandatoryNotFound, response.msg if response.mandatory_not_found? response.data end
enable(notify_url, channel_id, events, channel_expiry = nil, token = nil)
click to toggle source
# File lib/zoho_hub/notifications.rb, line 35 def enable(notify_url, channel_id, events, channel_expiry = nil, token = nil) body = post(request_path, watch: [{ notify_url: notify_url, channel_id: channel_id, events: events, channel_expiry: channel_expiry, token: token }]) build_response(body) end
request_path()
click to toggle source
# File lib/zoho_hub/notifications.rb, line 20 def request_path @request_path = 'actions/watch' end