Class: Address::Io::City

Inherits:
Object
  • Object
show all
Includes:
ApiResource
Defined in:
lib/address/io/city.rb

Constant Summary

Constants included from ApiResource

ApiResource::BASE_URL

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ApiResource

#api_request, #encode, included, #recursive_symbolize_keys, #url_encode

Class Method Details

.list_all(params = nil) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/address/io/city.rb', line 13

def self.list_all(params=nil)
  if params && params[:state]
    @state = params[:state]
    api_request(url, :get, params)
  else
    nil
  end
end

.urlObject



5
6
7
# File 'lib/address/io/city.rb', line 5

def self.url
  "/v1/states/#{@state}/cities"
end

Instance Method Details

#urlObject



9
10
11
# File 'lib/address/io/city.rb', line 9

def url
  "#{self.class.url}/#{self.id}"
end