module Her::WebMock::Helper
Public Class Methods
attributes_without_embedded_associations(klass, object)
click to toggle source
# File lib/her/webmock/model.rb, line 8 def self.attributes_without_embedded_associations(klass, object) attributes = object.respond_to?(:attributes) ? object.attributes.dup : object.dup klass.associations.each do |type, association_metadata_ary| association_metadata_ary.each do |association_metadata| association = attributes.delete(association_metadata[:name]) attributes[association_metadata[:foreign_key]] = association.id if association end end attributes end
default_headers()
click to toggle source
# File lib/her/webmock/model.rb, line 33 def self.default_headers WebMock.config.default_request_test_headers end
request_params(options = {})
click to toggle source
# File lib/her/webmock/model.rb, line 22 def self.request_params(options = {}) request_params = {} request_params[:query] = options[:query] headers_hash = default_headers.merge(options.fetch(:headers, {})) request_params[:headers] = headers_hash unless headers_hash.empty? request_params end