module Spyke::Http

Constants

METHODS

Public Instance Methods

uri() click to toggle source
# File lib/spyke/http.rb, line 98
def uri
  Path.new(@uri_template, attributes) if @uri_template
end

Private Instance Methods

add_errors_to_model(errors_hash) click to toggle source
# File lib/spyke/http.rb, line 104
def add_errors_to_model(errors_hash)
  errors_hash.each do |field, field_errors|
    field_errors.each do |error_attributes|
      error = NormalizedValidationError.new(error_attributes)

      if errors.method(:add).arity == -2
        errors.add(field.to_sym, error.message, **error.options)
      else
        errors.add(field.to_sym, error.message, error.options)
      end
    end
  end
end
resolve_path_from_action(action) click to toggle source
# File lib/spyke/http.rb, line 118
def resolve_path_from_action(action)
  case action
  when Symbol then uri.join(action)
  when String then Path.new(action, attributes)
  else uri
  end
end