Class: Calendlyr::EventTypesResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/calendlyr/resources/event_types.rb

Constant Summary

Constants inherited from Resource

Resource::ERROR_CODES

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Calendlyr::Resource

Instance Method Details

#create_one_off(name:, host:, duration:, date_setting:, location:, **params) ⇒ Object



12
13
14
15
# File 'lib/calendlyr/resources/event_types.rb', line 12

def create_one_off(name:, host:, duration:, date_setting:, location:, **params)
  body = {name: name, host: host, duration: duration, date_setting: date_setting, location: location}.merge(params)
  EventType.new post_request("one_off_event_types", body: body).dig("resource").merge(client: client)
end

#list(**params) ⇒ Object



3
4
5
6
# File 'lib/calendlyr/resources/event_types.rb', line 3

def list(**params)
  response = get_request("event_types", params: params)
  Collection.from_response(response, type: EventType, client: client)
end

#list_available_times(event_type:, start_time:, end_time:, **params) ⇒ Object

Available Times



23
24
25
26
# File 'lib/calendlyr/resources/event_types.rb', line 23

def list_available_times(event_type:, start_time:, end_time:, **params)
  response = get_request("event_type_available_times", params: {event_type: event_type, start_time: start_time, end_time: end_time}.merge(params))
  Collection.from_response(response, type: EventTypes::AvailableTime, client: client)
end

#list_memberships(event_type:, **params) ⇒ Object



17
18
19
20
# File 'lib/calendlyr/resources/event_types.rb', line 17

def list_memberships(event_type:, **params)
  response = get_request("event_type_memberships", params: {event_type: event_type}.merge(params))
  Collection.from_response(response, type: EventTypes::Membership, client: client)
end

#retrieve(uuid:) ⇒ Object



8
9
10
# File 'lib/calendlyr/resources/event_types.rb', line 8

def retrieve(uuid:)
  EventType.new get_request("event_types/#{uuid}").dig("resource").merge(client: client)
end