Class: ActiveForms::Form

Inherits:
Mapper
  • Object
show all
Defined in:
lib/active_forms/form.rb

Instance Attribute Summary

Attributes inherited from Mapper

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Mapper

#==, #apiVersion=, #initialize, #xmlns=

Constructor Details

This class inherits a constructor from ActiveForms::Mapper

Class Method Details

.all(params = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/active_forms/form.rb', line 7

def all(params = {})
  response = ActiveForms::Request.get("forms", params)

  hashes = response["forms"]["form"]
  hashes = [hashes] if hashes.is_a?(Hash)

  objects = hashes.nil? ? [] : hashes.map { |attributes| new(attributes) }
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/active_forms/form.rb', line 26

def active?
  status == "active"
end

#full_urlObject



17
18
19
20
21
22
23
24
# File 'lib/active_forms/form.rb', line 17

def full_url
  if url.starts_with?("http")
    url
  else
    host = ActiveForms.configuration.url[:protocol] + "://" + ActiveForms.configuration.url[:host]
    host << "/" << ActiveForms.configuration.base_url << "/" << url
  end
end

#inactive?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/active_forms/form.rb', line 30

def inactive?
  status == "inactive"
end