Module: DarkSky

Defined in:
lib/darksky-api.rb,
lib/darksky-api/day.rb,
lib/darksky-api/config.rb,
lib/darksky-api/current.rb,
lib/darksky-api/version.rb,
lib/darksky-api/location.rb,
lib/darksky-api/common-methods.rb

Overview

Author:

Version:

  • 0.1.3

Defined Under Namespace

Classes: CommonMethods, Location

Constant Summary collapse

VERSION =

version of this library (follows SemVer for versions >= 1.0.0)

'0.1.4'.freeze

Class Method Summary collapse

Class Method Details

.config(opts) ⇒ void

This method returns an undefined value.

set required and optional class variables

keyword arguments:

  • key [required] ─ API key from DarkSky
  • warnings [optional] ─ whether or not warnings are printed (default true)

Since:

  • 0.1.0



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/darksky-api/config.rb', line 10

def self.config(opts)
  defaults = {
    units: :si
  }
  opts = defaults.merge opts

  # required parameters
  @@key = opts.fetch(:key)

  # optional parameters
  @@units = opts[:units]
end

.keyString

Returns API key that was set by .config().

Examples:

DarkSky.key #=> '0f1e2d3c4b5a6978'

Returns:

  • (String)

    API key that was set by .config()

Since:

  • 0.1.0



27
28
29
# File 'lib/darksky-api/config.rb', line 27

def self.key
  @@key
end