Class: Wufoo::Submission::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/wufoo/submission.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Response

Returns a new instance of Response.



23
24
25
26
# File 'lib/wufoo/submission.rb', line 23

def initialize(data)
  @data = data
  populate
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



21
22
23
# File 'lib/wufoo/submission.rb', line 21

def data
  @data
end

Instance Method Details

#entry_idObject



54
55
56
# File 'lib/wufoo/submission.rb', line 54

def entry_id
  @entry_id
end

#errorObject



42
43
44
# File 'lib/wufoo/submission.rb', line 42

def error
  @error || ''
end

#errorsObject



46
47
48
# File 'lib/wufoo/submission.rb', line 46

def errors
  @errors || []
end

#fail?Boolean

Returns:

  • (Boolean)


33
34
35
36
# File 'lib/wufoo/submission.rb', line 33

def fail?
  return true if data.nil? || data == {}
  error.size > 0
end

#messageObject



50
51
52
# File 'lib/wufoo/submission.rb', line 50

def message
  @message || ''
end

#success?Boolean

Returns:

  • (Boolean)


28
29
30
31
# File 'lib/wufoo/submission.rb', line 28

def success?
  return false if data.nil? || data == {}
  data['wufoo_submit'].first['success'] == 'true'
end

#valid?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/wufoo/submission.rb', line 38

def valid?
  errors.size == 0
end