Class: Arelastic::Queries::GeoPolygon

Inherits:
Query show all
Defined in:
lib/arelastic/queries/geo_polygon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Query

#negate, #nested

Methods inherited from Nodes::Node

#==, #convert_to_elastic, #read_option!

Methods included from Arities::Binary

#binary

Methods included from Arities::Polyadic

#polyadic

Methods included from Arities::Unary

#unary

Constructor Details

#initialize(field, points, options = {}) ⇒ GeoPolygon

Returns a new instance of GeoPolygon.



5
6
7
8
9
# File 'lib/arelastic/queries/geo_polygon.rb', line 5

def initialize(field, points, options = {})
  @field   = field
  @points  = points
  @options = options
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



4
5
6
# File 'lib/arelastic/queries/geo_polygon.rb', line 4

def field
  @field
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/arelastic/queries/geo_polygon.rb', line 4

def options
  @options
end

#pointsObject

Returns the value of attribute points.



4
5
6
# File 'lib/arelastic/queries/geo_polygon.rb', line 4

def points
  @points
end

Instance Method Details

#as_elasticObject



11
12
13
14
15
# File 'lib/arelastic/queries/geo_polygon.rb', line 11

def as_elastic
  params = {field => {"points" => points}}.update(options)

  { "geo_polygon" => params }
end