Sha256: af506148b7a2b7285b81c6f82a108fc50771d55d07ea03de4591055d475b64fe

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

Contents

module Calendlyr
  class EventResource < Resource
    def list(**params)
      response = get_request("scheduled_events", params: params)
      Collection.from_response(response, type: Event, client: client)
    end

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

    def cancel(uuid:, reason: nil)
      Events::Cancellation.new post_request("scheduled_events/#{uuid}/cancellation", body: {reason: reason}).dig("resource").merge(client: client)
    end

    # Invitee
    def list_invitees(uuid:, **params)
      response = get_request("scheduled_events/#{uuid}/invitees", params: params)
      Collection.from_response(response, type: Events::Invitee, client: client)
    end

    def retrieve_invitee(event_uuid:, invitee_uuid:)
      Events::Invitee.new get_request("scheduled_events/#{event_uuid}/invitees/#{invitee_uuid}").dig("resource").merge(client: client)
    end

    # Invitee No Show
    def retrieve_invitee_no_show(uuid:)
      Events::InviteeNoShow.new get_request("invitee_no_shows/#{uuid}").dig("resource").merge(client: client)
    end

    def create_invitee_no_show(invitee:)
      body = {invitee: invitee}
      Events::InviteeNoShow.new post_request("invitee_no_shows", body: body).dig("resource").merge(client: client)
    end

    def delete_invitee_no_show(uuid:)
      delete_request("invitee_no_shows/#{uuid}")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
calendlyr-0.7.4 lib/calendlyr/resources/event.rb
calendlyr-0.7.3 lib/calendlyr/resources/event.rb
calendlyr-0.7.2 lib/calendlyr/resources/event.rb
calendlyr-0.7.1 lib/calendlyr/resources/event.rb
calendlyr-0.7.0 lib/calendlyr/resources/event.rb