Class: Recras::ContactForm
- Inherits:
-
Object
- Object
- Recras::ContactForm
- Extended by:
- Recras
- Defined in:
- lib/recras/contact_form.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.
- #id ⇒ Object
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
-
.attribute_mapping ⇒ Object
translates the mapping between the Recras API and the terms used in this gem.
- .plural_name ⇒ Object
Instance Method Summary collapse
-
#contact_form_fields ⇒ Object
returns an array of Recras::ContactFormField elements.
-
#default_values ⇒ Object
returns the minimum required attributes to make a valid booking.
-
#initialize(args = nil) ⇒ ContactForm
constructor
Initializer to transform a
Hashinto an Client object.
Methods included from Recras
make_request, new_from_json, object_mappings, parse_json, url, version
Constructor Details
#initialize(args = nil) ⇒ ContactForm
Initializer to transform a Hash into an Client object
16 17 18 19 20 21 22 |
# File 'lib/recras/contact_form.rb', line 16 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.
11 12 13 |
# File 'lib/recras/contact_form.rb', line 11 def client @client end |
#id ⇒ Object
The is a required parameter.
9 10 11 |
# File 'lib/recras/contact_form.rb', line 9 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/recras/contact_form.rb', line 10 def name @name end |
Class Method Details
.attribute_mapping ⇒ Object
translates the mapping between the Recras API and the terms used in this gem
51 52 53 |
# File 'lib/recras/contact_form.rb', line 51 def self.attribute_mapping [["id", "id"],["name", "name"]] end |
.plural_name ⇒ Object
24 25 26 |
# File 'lib/recras/contact_form.rb', line 24 def self.plural_name "contact_forms" end |
Instance Method Details
#contact_form_fields ⇒ Object
returns an array of Recras::ContactFormField elements
29 30 31 32 33 34 35 36 |
# File 'lib/recras/contact_form.rb', line 29 def contact_form_fields json = client.make_request("contactformulieren/#{id}/velden") a = [] for element in json a << Recras.parse_json(json: element, endpoint: "velden", client: client) end return a end |
#default_values ⇒ Object
returns the minimum required attributes to make a valid booking. Only use this for testing purpose.
40 41 42 43 44 45 46 |
# File 'lib/recras/contact_form.rb', line 40 def default_values a = {} for field in contact_form_fields a[field.field_identifier] = field.default_value end return a end |