Class: OSMN::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/osmn/base.rb

Direct Known Subclasses

Reverse, Search

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/osmn/base.rb', line 8

def initialize(params)
  @params = {}
  self.params = params
end

Instance Method Details

#paramsObject



24
25
26
# File 'lib/osmn/base.rb', line 24

def params
  @params
end

#params=(value) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/osmn/base.rb', line 13

def params=(value)
  if value.is_a? Hash
    value.each do |k,v|
      @params[k.to_sym] = v
    end
  end

  # We override the format because we expect a JSON response
  @params[:format] = :json
end