Posts Gem previsao-clima-tempo
Post
Cancel

Gem previsao-clima-tempo


Gem Version

Communication with Clima Tempo accessing information about the weather of Brazil.

Installation

Add this line to your application’s Gemfile:

    gem 'previsao-clima-tempo'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install previsao-clima-tempo

Usage

From Webservice

.new

Instantiating a object.The city code should be informed.

PrevisaoClimaTempo.new(:codCity => '3156')
     
.now

Returns an object PrevisaoDia with information from the current day.

     PrevisaoClimaTempo.new(:codCity => '3156').now
     
.tomorrow

Returns an object PrevisaoDia with information the next day.

     PrevisaoClimaTempo.new(:codCity => '3156').tomorrow
     
.days

Returns a collection of objects PrevisaoDia with information of days referenced.

     PrevisaoClimaTempo.new(:codCity => '3156').days(13) maximum of 13 days from the current day
     
.day

Returns an object PrevisaoDia with information the day referenced.

     PrevisaoClimaTempo.new(:codCity => '3156').day(date)
     

From Page

(contains more information than is extracted from the webservice)

.nowFromPage

Returns a hash of condtions of weather from page

	 PrevisaoClimaTempo.new(:codCity => '314').nowFromPage
	 

return:

	 {
		:last_update: 18:00
		:wind:
		  :velocity: 3 Km/h
		  :direction: Su-sudeste
		:moisture: 91%
		:condition: Poucas nuvens
		:pression: 1022 hPa
		:temperature: 13ºC  
 	 }
 	 
.fullFromPage

Returns a hash of condtions of weather whith 5 days from page.

  	 PrevisaoClimaTempo.new(:codCity => '314').fullFromPage
  	 

return:

	 {
		1:
		  :last_update: 19:00
		  :date: Sábado, 17/08/2013
		  :condition: Sol com muitas nuvens durante o dia e períodos de céu nublado. Noite
		    com muitas nuvens.
		  :wind:
		    :velocity: 6km/h
		    :direction: Su-sudeste
		  :probability_of_precipitation:
		    :volume: 0mm
		    :percentage: 0%
		  :moisture_relative_complete:
		    :max: 100%
		    :min: 49%
		  :temperature:
		    :max: 16º
		    :min: 7º
		  :uv: Alto
		  :sunrise: 06h13
		  :sunset: 17h36
		2: ...
 	 }
 	 
.trendsFromPage

Returns a hash of condtions of weather whith 5 days from page. If today is 16-12-2013 returns 21,22,23,24,25 trends.

  	 PrevisaoClimaTempo.new(:codCity => '314').trendsFromPage
  	 

return:

	 {
		1:
		  :date: Quinta-Feira, 22/08/2013
		  :condition: Sol com algumas nuvens. Não chove.
		  :probability_of_precipitation:
		    :volume: 0mm
		    :percentage: 0%
		  :temperature:
		    :max: 23º
		    :min: 7º
		2: 
 	 }
 	 

Updated May 12, 2020 2020-05-13T06:35:06+08:00
This post is licensed under CC BY 4.0