Class: ROM::Solr::Dataset

Inherits:
HTTP::Dataset
  • Object
show all
Defined in:
lib/rom/solr/dataset.rb

Direct Known Subclasses

DocumentsDataset, SchemaInfoDataset

Instance Method Summary collapse

Instance Method Details

#each(&block) ⇒ Object



29
30
31
32
33
# File 'lib/rom/solr/dataset.rb', line 29

def each(&block)
  return to_enum unless block_given?

  enumerable_data.each(&block)
end

#has_params?Boolean



56
57
58
# File 'lib/rom/solr/dataset.rb', line 56

def has_params?
  params.any?
end

#has_request_data?Boolean



52
53
54
# File 'lib/rom/solr/dataset.rb', line 52

def has_request_data?
  !request_data.nil? && !request_data.empty?
end

#responseObject



48
49
50
# File 'lib/rom/solr/dataset.rb', line 48

def response
  cache.fetch_or_store(:response) { __response__ }
end

#uriObject



20
21
22
23
24
25
26
# File 'lib/rom/solr/dataset.rb', line 20

def uri
  uri_s = [options[:uri], path].compact.reject(&:empty?).join('/')

  URI(uri_s).tap do |u|
    u.query = param_encoder.call(params) if has_params?
  end
end

#with_request_data(data) ⇒ Object



35
36
37
# File 'lib/rom/solr/dataset.rb', line 35

def with_request_data(data)
  with_options(request_data: data)
end

#with_response_key(*path) ⇒ Object



39
40
41
# File 'lib/rom/solr/dataset.rb', line 39

def with_response_key(*path)
  with_options(response_key: path)
end