Class: SupportOps::Calendly::Groups

Inherits:
Base
  • Object
show all
Defined in:
lib/support_ops_calendly/calendly/groups.rb

Overview

Defines the module Groups within the module SupportOps::Calendly.

Author:

  • Jason Colyer

Since:

  • 1.0.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

attributes, client, #client=, configure, define_attributes, #delete!, #find, #find!, #initialize, #members, readonly_attributes, #save!, #store_original_attributes

Constructor Details

This class inherits a constructor from SupportOps::Calendly::Base

Instance Attribute Details

#created_atString

The moment when the Group record was created

Returns:

  • (String)

    the current value of created_at



18
19
20
# File 'lib/support_ops_calendly/calendly/groups.rb', line 18

def created_at
  @created_at
end

#member_countInteger

The number of members in a group

Returns:

  • (Integer)

    the current value of member_count



18
19
20
# File 'lib/support_ops_calendly/calendly/groups.rb', line 18

def member_count
  @member_count
end

#nameString

The Group name (in human-readable format)

Returns:

  • (String)

    the current value of name



18
19
20
# File 'lib/support_ops_calendly/calendly/groups.rb', line 18

def name
  @name
end

#organizationString

A unique reference to the associated Organization object

Returns:

  • (String)

    the current value of organization



18
19
20
# File 'lib/support_ops_calendly/calendly/groups.rb', line 18

def organization
  @organization
end

#updated_atString

The moment when the Group record was last updated

Returns:

  • (String)

    the current value of updated_at



18
19
20
# File 'lib/support_ops_calendly/calendly/groups.rb', line 18

def updated_at
  @updated_at
end

#uriString

Canonical reference (unique identifier) for the Group resource

Returns:

  • (String)

    the current value of uri



18
19
20
# File 'lib/support_ops_calendly/calendly/groups.rb', line 18

def uri
  @uri
end

Class Method Details

.get(object) ⇒ Object

Get a specified Webhook Subscription

Examples:

require 'support_ops_calendly'

SupportOps::Calendly::Configuration.configure do |config|
  config.token = 'abc123'
end

groups = SupportOps::Calendly::Groups.get('FFFFFFFFFFFFFFFF')
pp group.uri
#=> "https://api.calendly.com/webhook_subscriptions/FFFFFFFFFFFFFFFF"

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



105
106
107
108
109
110
111
# File 'lib/support_ops_calendly/calendly/groups.rb', line 105

def self.get(object)
  if object.is_a? Groups
    Groups.new(uri: uri).find
  else
    Groups.new(uri: object).find
  end
end

.get!(object) ⇒ Object

Get a specified Webhook Subscription

Examples:

require 'support_ops_calendly'

SupportOps::Calendly::Configuration.configure do |config|
  config.token = 'abc123'
end

groups = SupportOps::Calendly::Groups.get!('FFFFFFFFFFFFFFFF')
pp group.uri
#=> "https://api.calendly.com/webhook_subscriptions/FFFFFFFFFFFFFFFF"

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



131
132
133
134
135
136
137
# File 'lib/support_ops_calendly/calendly/groups.rb', line 131

def self.get!(object)
  if object.is_a? Groups
    Groups.new(uri: uri).find!
  else
    Groups.new(uri: object).find!
  end
end

.list(key: value) ⇒ Object

Returns a list of groups

Examples:

require 'support_ops_calendly'

SupportOps::Calendly::Configuration.configure do |config|
  config.token = 'abc123'
end

groups = SupportOps::Calendly::Groups.list(
  organization: 'https://api.calendly.com/organizations/BBBBBBBBBBBBBBBB',
)
pp groups.first.uri
#=> "https://api.calendly.com/webhook_subscriptions/FFFFFFFFFFFFFFFF"
pp groups.count
#=> 2

Parameters:

  • organization (String required)

    The given organization URI that owns the subscriptions being returned

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/support_ops_calendly/calendly/groups.rb', line 67

def self.list(**args)
  args[:organization] = nil unless args[:organization]
  raise 'You must provide an organization URI' if args[:organization].nil?

  array = []
  data = {
    count: 100,
    organization: args[:organization]
  }
  loop do
    response = client.connection.get('groups', data)
    body = Oj.load(response.body)
    array += body['collection'].map { |g| Groups.new(g) }
    break if body['pagination']['next_page_token'].nil?

    data['page_token'] = body['pagination']['next_page_token']
  end
  array
end

Instance Method Details

#uuidString

Note:

This is inherited from Base#uuid

Returns the UUID of a group

Examples:

require 'support_ops_calendly'

SupportOps::Calendly::Configuration.configure do |config|
  config.token = 'abc123'
end

group = SupportOps::Calendly::Groups.get!('EEEEEEEEEEEEEEEE')
pp group.uuid
#=> "BBBBBBBBBBBBBBBB"

Returns:

  • (String)

    The UUID

Author:

  • Jason Colyer

Since:

  • 1.0.0



17
# File 'lib/support_ops_calendly/calendly/groups.rb', line 17

def uuid; end