class CGIParty::Response

Attributes

received_at[R]

Public Class Methods

new(source_data) click to toggle source
# File lib/cgi_party/response.rb, line 5
def initialize(source_data)
  @source_data = source_data
  @received_at = Time.now
end

Public Instance Methods

method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/cgi_party/response.rb, line 10
def method_missing(method_name, *args, &block)
  return fetch_value(method_name) if key_present?(method_name)
  super
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/cgi_party/response.rb, line 15
def respond_to_missing?(method_name, include_private = false)
  key_present?(method_name) || super
end

Private Instance Methods

fetch_value(key) click to toggle source
# File lib/cgi_party/response.rb, line 21
def fetch_value(key)
  @source_data.values.first.fetch(key.to_sym, nil)
end
key_present?(key) click to toggle source
# File lib/cgi_party/response.rb, line 25
def key_present?(key)
  @source_data.values.first.key?(key)
end