Class: Readiness::Calendly::Organizations
- Inherits:
-
Readiness::Client
- Object
- Readiness::Client
- Readiness::Calendly::Organizations
- Defined in:
- lib/support_readiness/calendly/organizations.rb
Overview
Defines the class Organizations within the module Readiness::Calendly.
Instance Attribute Summary collapse
- #created_at ⇒ Object
- #name ⇒ Object
- #plan ⇒ Object
- #stage ⇒ Object
- #updated_at ⇒ Object
- #uri ⇒ Object
Class Method Summary collapse
-
.current(client) ⇒ Object
Returns the current user’s organization within Calendly.
-
.find(client, oid) ⇒ Object
Locates an organization within Calendly.
-
.find!(client, oid) ⇒ Object
Locates an organization within Calendly.
-
.members(client, organization) ⇒ Array
Provides a list of organization memberships.
Instance Method Summary collapse
-
#initialize(object = {}) ⇒ Organizations
constructor
Creates a new Organizations instance.
Methods inherited from Readiness::Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Constructor Details
#initialize(object = {}) ⇒ Organizations
Creates a new Readiness::Calendly::Organizations instance
24 25 26 27 28 29 30 31 |
# File 'lib/support_readiness/calendly/organizations.rb', line 24 def initialize(object = {}) @created_at = object['created_at'] @name = object['name'] @plan = object['plan'] @stage = object['stage'] @updated_at = object['updated_at'] @uri = object['uri'] end |
Instance Attribute Details
#created_at ⇒ Object
13 14 15 |
# File 'lib/support_readiness/calendly/organizations.rb', line 13 def created_at @created_at end |
#name ⇒ Object
13 14 15 |
# File 'lib/support_readiness/calendly/organizations.rb', line 13 def name @name end |
#plan ⇒ Object
13 14 15 |
# File 'lib/support_readiness/calendly/organizations.rb', line 13 def plan @plan end |
#stage ⇒ Object
13 14 15 |
# File 'lib/support_readiness/calendly/organizations.rb', line 13 def stage @stage end |
#updated_at ⇒ Object
13 14 15 |
# File 'lib/support_readiness/calendly/organizations.rb', line 13 def updated_at @updated_at end |
#uri ⇒ Object
13 14 15 |
# File 'lib/support_readiness/calendly/organizations.rb', line 13 def uri @uri end |
Class Method Details
.current(client) ⇒ Object
Returns the current user’s organization within Calendly.
49 50 51 52 |
# File 'lib/support_readiness/calendly/organizations.rb', line 49 def self.current(client) user = Users.current(client) Organizations.find(client, user.current_organization.split('/').last) end |
.find(client, oid) ⇒ Object
Locates an organization within Calendly. This will not exit on error (except Authentication errors)
71 72 73 74 75 |
# File 'lib/support_readiness/calendly/organizations.rb', line 71 def self.find(client, oid) response = client.connection.get "organizations/#{oid}" handle_request_error(0, 'Calendly', response.status, { action: 'get', id: oid }) unless response.status == 200 Organizations.new(Oj.load(response.body)['resource']) end |
.find!(client, oid) ⇒ Object
Locates an organization within Calendly. This will exit on error
94 95 96 97 98 |
# File 'lib/support_readiness/calendly/organizations.rb', line 94 def self.find!(client, oid) response = client.connection.get "organizations/#{oid}" handle_request_error(1, 'Calendly', response.status, { action: 'Find organization', id: oid }) unless response.status == 200 Organizations.new(Oj.load(response.body)['resource']) end |
.members(client, organization) ⇒ Array
Provides a list of organization memberships. A wrapper for Readiness::Calendly::OrganizationMemberships.list
118 119 120 |
# File 'lib/support_readiness/calendly/organizations.rb', line 118 def self.members(client, organization) Readiness::Calendly::OrganizationMemberships.list(client, organization) end |