Class: Calendly::RoutingForm

Inherits:
Object
  • Object
show all
Includes:
ModelUtils
Defined in:
lib/calendly/models/routing_form.rb

Overview

Calendly’s routing form model.

Constant Summary collapse

UUID_RE =
%r{\A#{Client::API_HOST}/routing_forms/(#{UUID_FORMAT})\z}.freeze
TIME_FIELDS =
%i[created_at updated_at].freeze

Constants included from ModelUtils

ModelUtils::UUID_FORMAT

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ModelUtils

#client, #id, included, #initialize, #inspect

Instance Attribute Details

#created_atTime

Moment when user record was first created.

Returns:

  • (Time)


35
36
37
# File 'lib/calendly/models/routing_form.rb', line 35

def created_at
  @created_at
end

#nameString

The routing form name (in human-readable format).

Returns:

  • (String)


27
28
29
# File 'lib/calendly/models/routing_form.rb', line 27

def name
  @name
end

#organizationCalendly::Organization

The URI of the organization that’s associated with the routing form.



43
44
45
# File 'lib/calendly/models/routing_form.rb', line 43

def organization
  @organization
end

#questionsArray<Calendly::RoutingFormQuestion>

An ordered collection of Routing Form non-deleted questions.

Returns:



47
48
49
# File 'lib/calendly/models/routing_form.rb', line 47

def questions
  @questions
end

#statusString

Indicates if the form is in “draft” or “published” status.

Returns:

  • (String)


31
32
33
# File 'lib/calendly/models/routing_form.rb', line 31

def status
  @status
end

#updated_atTime

Moment when user record was last updated.

Returns:

  • (Time)


39
40
41
# File 'lib/calendly/models/routing_form.rb', line 39

def updated_at
  @updated_at
end

#uriString

Canonical reference (unique identifier) for the routing form.

Returns:

  • (String)


23
24
25
# File 'lib/calendly/models/routing_form.rb', line 23

def uri
  @uri
end

#uuidString

unique id of the RoutingForm object.

Returns:

  • (String)


19
20
21
# File 'lib/calendly/models/routing_form.rb', line 19

def uuid
  @uuid
end

Class Method Details

.associationObject



10
11
12
13
14
15
# File 'lib/calendly/models/routing_form.rb', line 10

def self.association
  {
    organization: Organization,
    questions: RoutingFormQuestion
  }
end

Instance Method Details

#fetchCalendly::RoutingForm

Get Routing Form associated with self.

Returns:

Raises:

Since:

  • 0.12.0



56
57
58
# File 'lib/calendly/models/routing_form.rb', line 56

def fetch
  client.routing_form uuid
end

#submissions(options: nil) ⇒ Array<Calendly::RoutingFormSubmission>

Returns all Routing Form Submissions associated with self.

Parameters:

  • options (Hash) (defaults to: nil)

    the optional request parameters. Optional.

Options Hash (options:):

  • :count (Integer)

    Number of rows to return.

  • :page_token (String)

    Pass this to get the next portion of collection.

  • :sort (String)

    Order results by the specified field and directin. Accepts comma-separated list of field:direction values.

Returns:

Raises:

Since:

  • 0.12.0



71
72
73
74
75
76
# File 'lib/calendly/models/routing_form.rb', line 71

def submissions(options: nil)
  return @cached_submissions if defined?(@cached_submissions) && @cached_submissions

  request_proc = proc { |opts| client.routing_form_submissions uri, options: opts }
  @cached_submissions = auto_pagination request_proc, options
end

#submissions!(options: nil) ⇒ Object

Since:

  • 0.12.0



79
80
81
82
# File 'lib/calendly/models/routing_form.rb', line 79

def submissions!(options: nil)
  @cached_submissions = nil
  submissions options: options
end