class Recras::ContactForm

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

Attributes

client[RW]
id[RW]

@note The is a required parameter.

json[RW]
name[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.rb, line 52
def self.attribute_mapping
  [["id", "id"],["name", "name"]]
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.rb, line 17
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
plural_name() click to toggle source
# File lib/recras/contact_form.rb, line 25
def self.plural_name
  "contact_forms"
end

Public Instance Methods

contact_form_fields() click to toggle source

returns an array of Recras::ContactFormField elements

# File lib/recras/contact_form.rb, line 30
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() click to toggle source

returns the minimum required attributes to make a valid booking. Only use this for testing purpose.

# File lib/recras/contact_form.rb, line 41
def default_values
  a = {}
  for field in contact_form_fields
    a[field.field_identifier] = field.default_value
  end
  return a
end