Method: DataMapper::Persevere::Query#json_query_headers

Defined in:
lib/persevere_adapter/query.rb

#json_query_headersObject

The headers of a json query

Author:

  • lamb


195
196
197
198
199
200
201
202
203
204
# File 'lib/persevere_adapter/query.rb', line 195

def json_query_headers
  headers = Hash.new
  offset = self.offset.to_i
  limit = self.limit.nil? ? nil : self.limit.to_i + offset - 1

  if offset != 0 || !limit.nil?
    headers.merge!( {"Range" => "items=#{offset}-#{limit}"} )
  end
  return headers
end