class Recras::ContactFormField

links to 'arrangement_regels' in the API recras.github.io/docs/endpoints/contactformulieren.html

Attributes

client[RW]
contact_form[RW]
contact_form_id[RW]
field_identifier[RW]
id[RW]

@note The is a required parameter.

input_type[RW]
json[RW]
name[RW]
options[RW]
required[RW]
special_for_booking[RW]

Public Class Methods

attribute_mapping() click to toggle source

translates the mapping between the Recras API and the terms used in this gem

# File lib/recras/contact_form_field.rb, line 33
def self.attribute_mapping
  [
    ["id", "id"],
    ["naam", "name"],
    ["contactformulier_id", "contact_form_id"], 
    ["soort_invoer", "input_type"], 
    ["verplicht", "required"], 
    ["mogelijke_keuzes", "options"],
    ["bijzonderheden_boeking", "special_for_booking"],
    ["field_identifier", "field_identifier"]
  ]
end
new(args=nil) click to toggle source

Initializer to transform a Hash into an Client object

@param [Hash] args

# File lib/recras/contact_form_field.rb, line 23
def initialize(args=nil)
  required_args = []
  return if args.nil?
  args.each do |k,v|
    instance_variable_set("@#{k}", v) unless v.nil?
  end
end

Public Instance Methods

default_value() click to toggle source

returns default values for this field_identifier

# File lib/recras/contact_form_field.rb, line 47
def default_value
  if field_identifier == "contactpersoon.email1"
    return "test@example.org"
  elsif field_identifier == "contactpersoon.naam"
    return "Naamloos"
  elsif field_identifier == "contactpersoon.voornaam"
    return "Voornaam"
  elsif field_identifier == "contactpersoon.achternaam"
    return "Achternaam"
  elsif field_identifier == "veel_tekst"
    return "tekst"
  else
    # raise ERRR
    return ""
  end
end