Module: GeoGuard

Defined in:
lib/geoguard.rb,
lib/geoguard/version.rb,
lib/geoguard/configuration.rb

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



10
11
12
# File 'lib/geoguard.rb', line 10

def self.configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



14
15
16
# File 'lib/geoguard.rb', line 14

def self.configure
  yield(configuration) if block_given?
end

.update(cache_headers: {}) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/geoguard.rb', line 18

def self.update(cache_headers: {})
  path = "/v1/update/#{configuration.format}/geostream"
  headers = {
    'X-Geostream-License-Key' => configuration.license,
    'X-Geostream-Client-Id' => configuration.client_id
  }.merge(cache_headers)
  response = RestClient.get("#{configuration.host}#{path}", headers)
  response.body if response.code >= 200 && response.code < 300
end