Class: ActiveForms::Entry
Instance Attribute Summary
Attributes inherited from Mapper
Class Method Summary collapse
- .all(params = {}) ⇒ Object
-
.create(params = {}) ⇒ Object
required params: apiFormCode field id.
-
.delete(params = {}) ⇒ Object
required params: apiFormCode apiNumber or apiEntryToken.
-
.find(params = {}) ⇒ Object
required params: apiFormCode - form’s code apiNumber or apiEntryToken - entry’s number or token.
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
8 9 10 11 12 13 14 15 |
# File 'lib/active_forms/entry.rb', line 8 def all(params = {}) response = ActiveForms::Request.get("entries", params) hashes = response["entries"]["entry"] hashes = [hashes] if hashes.is_a?(Hash) objects = hashes.nil? ? [] : hashes.map { |attributes| new(attributes) } end |
.create(params = {}) ⇒ Object
required params:
apiFormCode
field id
31 32 33 34 35 36 37 |
# File 'lib/active_forms/entry.rb', line 31 def create(params = {}) response = ActiveForms::Request.post("entrydata", params) attributes = response["entryPutConfirmation"] new(attributes) end |
.delete(params = {}) ⇒ Object
required params:
apiFormCode
apiNumber or apiEntryToken
42 43 44 45 |
# File 'lib/active_forms/entry.rb', line 42 def delete(params = {}) response = ActiveForms::Request.delete("entrydata", params) response && response.code.to_i == 204 end |
.find(params = {}) ⇒ Object
required params:
apiFormCode - form's code
apiNumber or apiEntryToken - entry's number or token
20 21 22 23 24 25 26 |
# File 'lib/active_forms/entry.rb', line 20 def find(params = {}) response = ActiveForms::Request.get("entrydata", params) attributes = response["entryData"] new(attributes) end |
Instance Method Details
#destroy ⇒ Object
48 49 50 |
# File 'lib/active_forms/entry.rb', line 48 def destroy ActiveForms::Entry.delete :apiFormCode => self.formCode, :apiNumber => self.number end |