This repository has been archived by the owner on Apr 25, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from pat/feature/namespacing
Changing Forecast::IO to ForecastIO to avoid naming collisions
- Loading branch information
Showing
9 changed files
with
99 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
module Forecast | ||
module IO | ||
module Configuration | ||
# Default API endpoint | ||
DEFAULT_FORECAST_IO_API_ENDPOINT = 'https://api.forecast.io' | ||
module ForecastIO | ||
module Configuration | ||
# Default API endpoint | ||
DEFAULT_FORECAST_IO_API_ENDPOINT = 'https://api.forecast.io' | ||
|
||
# Forecast API endpoint | ||
attr_writer :api_endpoint | ||
# Forecast API endpoint | ||
attr_writer :api_endpoint | ||
|
||
# API key | ||
attr_writer :api_key | ||
# API key | ||
attr_writer :api_key | ||
|
||
# Default parameters | ||
attr_accessor :default_params | ||
# Default parameters | ||
attr_accessor :default_params | ||
|
||
# Yield self to be able to configure Forecast::IO with block-style configuration. | ||
# | ||
# Example: | ||
# | ||
# Forecast::IO.configure do |configuration| | ||
# configuration.api_key = 'this-is-your-api-key' | ||
# end | ||
def configure | ||
yield self | ||
end | ||
# Yield self to be able to configure ForecastIO with block-style configuration. | ||
# | ||
# Example: | ||
# | ||
# ForecastIO.configure do |configuration| | ||
# configuration.api_key = 'this-is-your-api-key' | ||
# end | ||
def configure | ||
yield self | ||
end | ||
|
||
# API endpoint | ||
def api_endpoint | ||
@api_endpoint ||= DEFAULT_FORECAST_IO_API_ENDPOINT | ||
end | ||
# API endpoint | ||
def api_endpoint | ||
@api_endpoint ||= DEFAULT_FORECAST_IO_API_ENDPOINT | ||
end | ||
|
||
# API key | ||
def api_key | ||
@api_key | ||
end | ||
# API key | ||
def api_key | ||
@api_key | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
module Forecast | ||
module IO | ||
# Current Forecast::IO version | ||
VERSION = '1.2.0' | ||
end | ||
module ForecastIO | ||
VERSION = '1.2.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
require 'spec_helper' | ||
|
||
describe Forecast::IO::Configuration do | ||
describe ForecastIO::Configuration do | ||
describe '.configure' do | ||
it 'should have default attributes' do | ||
Forecast::IO.configure do |configuration| | ||
configuration.api_endpoint.should eql(Forecast::IO::Configuration::DEFAULT_FORECAST_IO_API_ENDPOINT) | ||
ForecastIO.configure do |configuration| | ||
configuration.api_endpoint.should eql(ForecastIO::Configuration::DEFAULT_FORECAST_IO_API_ENDPOINT) | ||
configuration.api_key.should be_nil | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Forecast::IO::VERSION' do | ||
describe 'ForecastIO::VERSION' do | ||
it 'should be the correct version' do | ||
Forecast::IO::VERSION.should == '1.2.0' | ||
ForecastIO::VERSION.should == '1.2.0' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,6 @@ | |
|
||
RSpec.configure do |config| | ||
config.before(:each) do | ||
Forecast::IO.api_key = nil | ||
ForecastIO.api_key = nil | ||
end | ||
end |