Class: BigMarkerClient::Api::V1::Conference::Registration

Inherits:
Base
  • Object
show all
Defined in:
lib/big_marker_client/api/v1/conference/registration.rb

Constant Summary collapse

LIST_REGISTRANTS =
"/conferences/registrations/{id}".freeze
LIST_REGISTRANTS_WITH_FIELDS =
"/conferences/registrations_with_fields/{id}".freeze
CREATE_REGISTRANT =
"/conferences/register".freeze
DELETE_REGISTRANT =
"/conferences/register".freeze
CHECK_REGISTRANT_STATUS =
"/conferences/{id}/check_registration_status".freeze

Constants inherited from Base

Base::DEFAULT_PER_PAGE_SIZE

Class Method Summary collapse

Methods inherited from Base

delete, get, patch, post, put

Class Method Details

.check_status(conference_id, params = {}) ⇒ String

check if a person is already registered to a conference. Recognized @params are

  • bmid: a unique big_marker id of a attendee

  • email: the email of an attendee

either of these two are required

Parameters:

  • conference_id (String)

    conference identifier

  • params (Hash) (defaults to: {})

    recognized are:

Returns:

  • (String)

    status (registered. not registered)



95
96
97
98
99
100
101
# File 'lib/big_marker_client/api/v1/conference/registration.rb', line 95

def check_status(conference_id, params = {})
  result = get(replace_path_params(path: CHECK_REGISTRANT_STATUS, replacements: { "{id}": conference_id }),
               params)
  return result["registration_status"] if result["registration_status"]

  result
end

.list(conference_id, params = {}) ⇒ BigMarkerClient::Models::Registrant[]

list all registrants to a conference.

  • page: pagination page

  • per_page: pagination page size (20*)

Parameters:

  • conference_id (String)

    conference identifier

  • params (Hash) (defaults to: {})

    recognized are:

Returns:



20
21
22
23
24
25
# File 'lib/big_marker_client/api/v1/conference/registration.rb', line 20

def list(conference_id, params = {})
  result = get(replace_path_params(path: LIST_REGISTRANTS, replacements: { "{id}": conference_id }), params)
  return map_to_model_array(result["registrations"]) if result["registrations"]

  result
end

.list_all(conference_id, params = {}) ⇒ Object

helper method to retrieve all pages for the #list method

See Also:

  • #list


30
31
32
33
# File 'lib/big_marker_client/api/v1/conference/registration.rb', line 30

def list_all(conference_id, params = {})
  path = replace_path_params(path: LIST_REGISTRANTS, replacements: { "{id}": conference_id })
  loop_over(path, "registrations", ::BigMarkerClient::Models::Registrant, params)
end

.list_all_with_fields(conference_id, params = {}) ⇒ Object

helper method to retrieve all pages for the #list_with_fields method

See Also:

  • #list_with_fields


53
54
55
56
# File 'lib/big_marker_client/api/v1/conference/registration.rb', line 53

def list_all_with_fields(conference_id, params = {})
  path = replace_path_params(path: LIST_REGISTRANTS_WITH_FIELDS, replacements: { "{id}": conference_id })
  loop_over(path, "registrations", ::BigMarkerClient::Models::Registrant, params)
end

.list_with_fields(conference_id, params = {}) ⇒ BigMarkerClient::Models::Registrant[]

list all registrants to a conference with custom fields.

  • page: pagination page

  • per_page: pagination page size (20*)

Parameters:

  • conference_id (String)

    conference identifier

  • params (Hash) (defaults to: {})

    recognized are:

Returns:



42
43
44
45
46
47
48
# File 'lib/big_marker_client/api/v1/conference/registration.rb', line 42

def list_with_fields(conference_id, params = {})
  result = get(replace_path_params(path: LIST_REGISTRANTS_WITH_FIELDS,
                                   replacements: { "{id}": conference_id }), params)
  return map_to_model_array(result["registrations"]) if result["registrations"]

  result
end

.register(conference_id, email, first_name, last_name, params = {}) ⇒ String

registers a participant to a conference.

  • temporary_password: a temporary password for registrant

  • custom_fields: uRL encoded JSON object, keys are custom_field ids.

  • utm_bmcr_source: registrant’s UTM source code

  • custom_user_id: external custom user id

Parameters:

  • conference_id (String)

    conference identifier

  • email (String)

    attendee email

  • first_name (String)

    attendee first name

  • last_name (String)

    attendee last name

  • params (Hash) (defaults to: {})

    recognized are:

Returns:

  • (String)

    URL for the participant to enter the conference



70
71
72
73
74
75
76
77
# File 'lib/big_marker_client/api/v1/conference/registration.rb', line 70

def register(conference_id, email, first_name, last_name, params = {})
  create_params = { id: conference_id, email: email, first_name: first_name, last_name: last_name }
                  .merge(params)
  result = post(CREATE_REGISTRANT, create_params)
  return result["conference_url"] if result["conference_url"]

  result
end

.unregister(conference_id, email) ⇒ Object

remove a participant from a conference

Parameters:

  • conference_id (String)

    conference identifier

  • email (String)

    attendee email



83
84
85
# File 'lib/big_marker_client/api/v1/conference/registration.rb', line 83

def unregister(conference_id, email)
  delete(DELETE_REGISTRANT, { id: conference_id, email: email })
end