Class: OpenTopo::Net::Params::CatalogParams

Inherits:
BaseParams
  • Object
show all
Defined in:
lib/open_topo/net/params/catalog_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseParams

#error_messages, #valid?, #validate!, validate_with

Constructor Details

#initialize(west: nil, south: nil, east: nil, north: nil, polygon: nil) ⇒ CatalogParams

Returns a new instance of CatalogParams.



11
12
13
14
15
16
17
18
19
# File 'lib/open_topo/net/params/catalog_params.rb', line 11

def initialize(west: nil, south: nil, east: nil, north: nil, polygon: nil)
  @west = west
  @south = south
  @east = east
  @north = north
  @polygon = polygon

  super()
end

Instance Attribute Details

#eastObject (readonly)

Returns the value of attribute east.



9
10
11
# File 'lib/open_topo/net/params/catalog_params.rb', line 9

def east
  @east
end

#northObject (readonly)

Returns the value of attribute north.



9
10
11
# File 'lib/open_topo/net/params/catalog_params.rb', line 9

def north
  @north
end

#polygonObject (readonly)

Returns the value of attribute polygon.



9
10
11
# File 'lib/open_topo/net/params/catalog_params.rb', line 9

def polygon
  @polygon
end

#southObject (readonly)

Returns the value of attribute south.



9
10
11
# File 'lib/open_topo/net/params/catalog_params.rb', line 9

def south
  @south
end

#westObject (readonly)

Returns the value of attribute west.



9
10
11
# File 'lib/open_topo/net/params/catalog_params.rb', line 9

def west
  @west
end

Instance Method Details

#to_paramsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/open_topo/net/params/catalog_params.rb', line 21

def to_params
  params = default_params

  if polygon
    params[:polygon] = polygon
  else
    params[:maxx] = east
    params[:minx] = west

    params[:maxy] = north
    params[:miny] = south
  end

  params
end