Class: Recras::ContactFormField
- Inherits:
-
Object
- Object
- Recras::ContactFormField
- Extended by:
- Recras
- Defined in:
- lib/recras/contact_form_field.rb
Overview
links to ‘arrangement_regels’ in the API recras.github.io/docs/endpoints/contactformulieren.html
Constant Summary
Constants included from Recras
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#contact_form ⇒ Object
Returns the value of attribute contact_form.
-
#contact_form_id ⇒ Object
Returns the value of attribute contact_form_id.
-
#field_identifier ⇒ Object
Returns the value of attribute field_identifier.
- #id ⇒ Object
-
#input_type ⇒ Object
Returns the value of attribute input_type.
-
#json ⇒ Object
Returns the value of attribute json.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#required ⇒ Object
Returns the value of attribute required.
-
#special_for_booking ⇒ Object
Returns the value of attribute special_for_booking.
Class Method Summary collapse
-
.attribute_mapping ⇒ Object
translates the mapping between the Recras API and the terms used in this gem.
Instance Method Summary collapse
-
#default_value ⇒ Object
returns default values for this field_identifier.
-
#initialize(args = nil) ⇒ ContactFormField
constructor
Initializer to transform a
Hash
into an Client object.
Methods included from Recras
make_request, new_from_json, object_mappings, parse_json, url, version
Constructor Details
#initialize(args = nil) ⇒ ContactFormField
Initializer to transform a Hash
into an Client object
23 24 25 26 27 28 29 |
# 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 |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
18 19 20 |
# File 'lib/recras/contact_form_field.rb', line 18 def client @client end |
#contact_form ⇒ Object
Returns the value of attribute contact_form.
17 18 19 |
# File 'lib/recras/contact_form_field.rb', line 17 def contact_form @contact_form end |
#contact_form_id ⇒ Object
Returns the value of attribute contact_form_id.
11 12 13 |
# File 'lib/recras/contact_form_field.rb', line 11 def contact_form_id @contact_form_id end |
#field_identifier ⇒ Object
Returns the value of attribute field_identifier.
16 17 18 |
# File 'lib/recras/contact_form_field.rb', line 16 def field_identifier @field_identifier end |
#id ⇒ Object
The is a required parameter.
9 10 11 |
# File 'lib/recras/contact_form_field.rb', line 9 def id @id end |
#input_type ⇒ Object
Returns the value of attribute input_type.
12 13 14 |
# File 'lib/recras/contact_form_field.rb', line 12 def input_type @input_type end |
#json ⇒ Object
Returns the value of attribute json.
19 20 21 |
# File 'lib/recras/contact_form_field.rb', line 19 def json @json end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/recras/contact_form_field.rb', line 10 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
14 15 16 |
# File 'lib/recras/contact_form_field.rb', line 14 def @options end |
#required ⇒ Object
Returns the value of attribute required.
13 14 15 |
# File 'lib/recras/contact_form_field.rb', line 13 def required @required end |
#special_for_booking ⇒ Object
Returns the value of attribute special_for_booking.
15 16 17 |
# File 'lib/recras/contact_form_field.rb', line 15 def special_for_booking @special_for_booking end |
Class Method Details
.attribute_mapping ⇒ Object
translates the mapping between the Recras API and the terms used in this gem
33 34 35 36 37 38 39 40 41 42 43 44 |
# 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 |
Instance Method Details
#default_value ⇒ Object
returns default values for this field_identifier
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/recras/contact_form_field.rb', line 47 def default_value if field_identifier == "contactpersoon.email1" return "[email protected]" 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 |