class ContactCongressParser::SuccessConditions

Attributes

data[R]

Public Class Methods

new(data) click to toggle source
# File lib/contact_congress_parser/success_conditions.rb, line 3
def initialize(data)
  @data = data
end

Public Instance Methods

to_s() click to toggle source
# File lib/contact_congress_parser/success_conditions.rb, line 7
def to_s
  (has_content_str     ? '  ' + has_content_str + "\n" : '') +
  (has_status_code_str ? '  ' + has_status_code_str + "\n" : '')
end

Private Instance Methods

content() click to toggle source
# File lib/contact_congress_parser/success_conditions.rb, line 23
def content
  data.fetch('body', {}).fetch('contains', nil)
end
has_content_str() click to toggle source
# File lib/contact_congress_parser/success_conditions.rb, line 15
def has_content_str
  "has_content? \"#{content}\"" if content
end
has_status_code_str() click to toggle source
# File lib/contact_congress_parser/success_conditions.rb, line 19
def has_status_code_str
  "has_status_code? #{status_code}" if status_code
end
status_code() click to toggle source
# File lib/contact_congress_parser/success_conditions.rb, line 27
def status_code
  data.fetch('headers', {}).fetch('status', nil)
end