weather_gem_kg 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02a8cf12c9c8e11bd58b612f0a4cabfed6fcbaa89b0c4671b6bec3b45fa9fad7
4
- data.tar.gz: c0ff3ea5a27edf08750775ff1e596420d233774755731a993c3262bc8094e876
3
+ metadata.gz: 489ba8d1984c11aaf6337b26df7a2dcda03dabd83002bc5372806e104227894b
4
+ data.tar.gz: f39c0ae0d3a142f87a7513262839955379ca8c97a6dd0529cf5813240d1a8af1
5
5
  SHA512:
6
- metadata.gz: c654dd71e142f317e4404023567b70838180666c126463efca1303152a8c3ffe617aaa5e9f3817da1316e2a8f2d059cad27fc27da9c60fc1aba3b4642d943016
7
- data.tar.gz: 1d4815336c89bae37c21c4fc42c38790356a19a8d184ef67f3c98aabfce71f5650bdb4d2b206e5484921b812a68847f33373de8208a70ce744413a25cae6205a
6
+ metadata.gz: a5a0ce01ca8f1d35af8a9bd8f327240720c8bdecdf3137501daaa26844ff2878d0423179e6ab8a4b9a423d591538c8700a68533c099a45d5d976428931672a74
7
+ data.tar.gz: 3de0ba3d4ffb1ad5bc5ea65ebc6305a7002b7543dacf8f473eb94df5e45c365b5ff76971bf199c5b04298295e3c94cdb7480aa37ac6eac624b74e2eb02f2a1f9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weather_gem_kg (0.30.0)
4
+ weather_gem_kg (0.31.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,4 @@
1
+ WeatherGemKg.configure do |config|
2
+ # config.api_key_apixu = '123dfafasdfasddf'
3
+ # config.api_key_dark = '1asd231sdasffas'
4
+ end
@@ -0,0 +1,14 @@
1
+ module WeatherGemKg
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+ desc "Creates Jem initializer for your application"
6
+
7
+ def copy_initializer
8
+ template "weather_gem_kg_initializer.rb", "config/initializers/weather_gem_kg.rb"
9
+
10
+ puts "Install complete! Truly Outrageous!"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -4,7 +4,6 @@ require "weather_gem_kg/generator"
4
4
  require "weather_gem_kg/config"
5
5
 
6
6
  module WeatherGemKg
7
- extend Configuration
8
7
  end
9
8
 
10
9
  # weather1 = WeatherGemKg::Generator.new('Bishkek', 1, WeatherGemKg::Clients::Apixu.new)
@@ -3,7 +3,7 @@ require_relative '../config'
3
3
  module WeatherGemKg
4
4
  module Clients
5
5
  class Apixu
6
- API_KEY = WeatherGemKg::Configuration.config.api_key_apixu
6
+ API_KEY = WeatherGemKg.configuration.api_key_apixu
7
7
 
8
8
  def initialize
9
9
  @base_url = "http://api.apixu.com/v1/forecast.json?key=#{API_KEY}"
@@ -4,7 +4,7 @@ require_relative '../config'
4
4
  module WeatherGemKg
5
5
  module Clients
6
6
  class DarkSky
7
- API_KEY = WeatherGemKg::Configuration.config.api_key_dark
7
+ API_KEY = WeatherGemKg.configuration.api_key_dark
8
8
 
9
9
  def initialize
10
10
  @base_url = "https://api.darksky.net/forecast/#{API_KEY}"
@@ -1,17 +1,26 @@
1
1
  module WeatherGemKg
2
- module Configuration
3
- Config = Struct.new :api_key_apixu, :api_key_dark
2
+ class << self
3
+ attr_accessor :configuration
4
+ end
4
5
 
5
- class << self
6
- attr_accessor :api_key_apixu, :api_key_dark
7
- end
6
+ def self.configuration
7
+ @configuration ||= Configuration.new
8
+ end
8
9
 
9
- def self.configure(&config_block)
10
- config_block.call config
11
- end
10
+ def self.configure
11
+ yield(configuration) if block_given?
12
+ end
13
+
14
+ class Configuration
15
+ attr_accessor :api_key_apixu, :api_key_dark
12
16
 
13
- def self.config
14
- @config ||= Config.new
17
+ def initialize
18
+ @api_key_apixu = nil
19
+ @api_key_dark = nil
15
20
  end
16
21
  end
17
22
  end
23
+ WeatherGemKg.configure do |c| # => MyGem
24
+ c.api_key_apixu = '6d79fff9ef764b8c85d61836190907' # => 1
25
+ c.api_key_dark = '0a06f48b71537e4e72554c3f8d39d234' # => "some string"
26
+ end # => "some string"
@@ -1,3 +1,3 @@
1
1
  module WeatherGemKg
2
- VERSION = "0.31.0"
2
+ VERSION = "0.32.0"
3
3
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather_gem_kg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.0
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edilbek
@@ -70,12 +70,15 @@ files:
70
70
  - Rakefile
71
71
  - bin/console
72
72
  - bin/setup
73
+ - lib/generators/templates/weather_gem_kg_initializer.rb
74
+ - lib/generators/weather_gem_kg/install_generator.rb
73
75
  - lib/weather_gem_kg.rb
74
76
  - lib/weather_gem_kg/clients/apixu.rb
75
77
  - lib/weather_gem_kg/clients/dark_sky.rb
76
78
  - lib/weather_gem_kg/config.rb
77
79
  - lib/weather_gem_kg/generator.rb
78
80
  - lib/weather_gem_kg/version.rb
81
+ - weather_gem_kg-0.31.0.gem
79
82
  - weather_gem_kg.gemspec
80
83
  homepage:
81
84
  licenses: