Class: GeoAPI::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/geoapi/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil) ⇒ Client

To connect to GeoAPI, either:

Add export GEOAPI_KEY=<your-api-key> in your .bashrc file

OR

OR set GEOAPI_KEY=‘<your-api-key>’ before including GeoAPI



18
19
20
# File 'lib/geoapi/client.rb', line 18

def initialize(api_key=nil)
  @api_key = api_key || ENV['GEOAPI_KEY'] || GeoAPI::GEOAPI_KEY
end

Class Method Details

.id_from_guid(guid, apikey) ⇒ Object



26
27
28
29
# File 'lib/geoapi/client.rb', line 26

def self.id_from_guid(guid,apikey)
  id = guid.sub('user-','')
  id = id.sub("#{apikey}-",'')
end

Instance Method Details

#api_keyObject



22
23
24
# File 'lib/geoapi/client.rb', line 22

def api_key
  @api_key
end