-
Notifications
You must be signed in to change notification settings - Fork 3
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 #2 from BecauseOfProg/develop
Releasing v0.2.3
- Loading branch information
Showing
11 changed files
with
266 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# <type>: (If applied, this commit will...) <subject> (Max 50 char) | ||
# |<---- Using a Maximum Of 50 Characters ---->| Hard limit to 72 -->| | ||
|
||
|
||
# Explain why this change is being made | ||
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| | ||
|
||
# Provide links to any relevant issues, articles, commits, or other | ||
# pull requests | ||
# Example: See #23, fixes #58 | ||
|
||
# --- COMMIT END --- | ||
# <type> can be | ||
# feat (new feature) | ||
# fix (bug fix) | ||
# refactor (refactoring production code) | ||
# style (formatting, missing semi colons, etc; no code change) | ||
# test (adding or refactoring tests; no production code change) | ||
# chore (updating npm scripts etc; no production code change) | ||
# -------------------- | ||
# Remember to | ||
# Capitalize the subject line | ||
# Use the imperative mood in the subject line | ||
# Do not end the subject line with a period | ||
# Separate subject from body with a blank line (comments don't count) | ||
# Use the body to explain what and why vs. how | ||
# Can use multiple lines with "-" for bullet points in body | ||
# | ||
# If you can't summarize your changes in a single line, they should | ||
# probably be split into multiple commits | ||
# -------------------- | ||
# For more information about this template, check out | ||
# https://gist.github.com/adeekshith/cd4c95a064977cdc6c50 |
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,2 +1,3 @@ | ||
*.gem | ||
.vscode/ | ||
.vscode/ | ||
.idea |
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,9 +1,99 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'net/http' | ||
require 'json' | ||
|
||
require 'openweathermap/data/constants' | ||
require 'openweathermap/data/exceptions' | ||
require 'openweathermap/classes' | ||
require 'openweathermap/current-weather' | ||
require 'openweathermap/forecast' | ||
require 'openweathermap/api' | ||
|
||
module OpenWeatherMap | ||
|
||
## | ||
# All the constants needed for the library | ||
|
||
module Constants | ||
|
||
## | ||
# URL of the OpenWeatherMap API | ||
|
||
API_URL = 'https://api.openweathermap.org' | ||
|
||
## | ||
# Accepted types of unit | ||
|
||
UNITS = %w(default metric imperial) | ||
|
||
## | ||
# Accepted locales | ||
|
||
LANGS = %w(ar bg ca cz de el fa fi fr gl hr hu it ja kr la lt mk nl pl pt ro ru se sk sl es tr ua vi zh_cn zh_tw en) | ||
|
||
## | ||
# The different URLs | ||
|
||
URLS = { | ||
current: '/data/2.5/weather', | ||
forecast: '/data/2.5/forecast' | ||
} | ||
|
||
## | ||
# All condition codes associated with emojis | ||
|
||
CONDITION_CODE = { | ||
'01d' => '☀', | ||
'02d' => '⛅', | ||
'03d' => '☁', | ||
'04d' => '☁☁', | ||
'09d' => '🌧', | ||
'10d' => '🌦', | ||
'11d' => '🌩', | ||
'13d' => '🌨', | ||
'50d' => '🌫', | ||
} | ||
end | ||
|
||
## | ||
# Base exception for the OpenWeatherMap library | ||
|
||
class Exception < StandardError | ||
end | ||
|
||
## | ||
# Exceptions that can be thrown by the library | ||
|
||
module Exceptions | ||
|
||
## | ||
# Exception to handle unknown lang | ||
|
||
class UnknownLang < OpenWeatherMap::Exception | ||
end | ||
|
||
## | ||
# Exception to handle unknown units | ||
|
||
class UnknownUnits < OpenWeatherMap::Exception | ||
end | ||
|
||
## | ||
# Exception to handle unknown location | ||
|
||
class UnknownLocation < OpenWeatherMap::Exception | ||
end | ||
|
||
## | ||
# Exception to tell that the API key isn't authorized | ||
|
||
class Unauthorized < OpenWeatherMap::Exception | ||
end | ||
|
||
## | ||
# Exception to handle data error | ||
|
||
class DataError < OpenWeatherMap::Exception | ||
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
Oops, something went wrong.