Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jma

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jma

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

JMA - UNOFFICIAL Japan Meteorological Agency (気象庁) API client

This repository contains a gem for the Japan Meteorological Agency (気象庁) for searching new information simplifies. To use the API contains information, see the terms and conditions. (気象庁ホームページについて)

Features

  • Overall retrieves information from the three API Feed, Response XML and Response JSON.
  • Favor requests a server with If-Modified-Since.
  • Appreciatively displays the entire connection log.

Installation

Add this line to your application's Gemfile:

gem 'jma'

And then execute:

bundle install

Or install it yourself as:

gem install jma

Configuration

To construct a client, available to configure a :response_type, :logger, :temporary_directory and :cache.

client = JMA::Client.new.tap do |config|
  config.response_type = :raw
  config.logger = Logger.new($stdout)
  config.cache = ActiveSupport::Cache.lookup_store(:file_store, 'tmp')
end

Constructor Details

Options Hash:

  • :response_type(Symbol) -- The API response type, by default: response_type does not convert the response. You may specify below options..
    • :raw
    • :object
  • :logger(Instance) -- The instance to logging, a default :logger will print log to display.
  • :temporary_directory(String) -- The locate directory to store the cache, a default :temporary_directory is 'tmp' directory at run a gem.
  • :cache(Instance) -- The cache instance that stores the time of the reply date from the API, a default value: cache will use ActiveSupport::Cache.

Usage

QQTW (Quickest Quick-start in The West)¶

feed = JMA::Client.new.tap do |config|
	config.response_type = :object
end.request_extra

puts <<~EOF
発表時刻: #{feed.updated.content.strftime('%Y-%m-%d %H:%M:%S')}#{feed.title.content} - #{feed.subtitle.content}#{feed.items.first.content.content} 
#{feed.items.first.id.content} 
#{feed.items.first.author.name.content} 
EOF

#=> 発表時刻: 2022-01-07 19:53:07 「高頻度(随時) - JMAXML publishing feed」
#=>  【石狩・空知・後志地方気象警報・注意報】後志地方では、8日までなだれに注意してください。 
#=>  http://www.data.jma.go.jp/developer/xml/data/20220107105234_0_VPWW53_016000.xml 
#=>  札幌管区気象台

Client Operations

Feeds

When you specify :object at :response_type, Obtain an RSS::Atom::Entry object.

Regular (定時)

気象に関する情報のうち、天気概況など定時に発表されるもの。毎分更新し、直近少なくとも10分入電を掲載しています。*1

  • #request_regular()
    • 高頻度
  • #request_regular_long()
    • 長期
Extra (随時)

気象に関する情報のうち、警報・注意報など随時発表されるもの。毎分更新し、直近少なくとも10分入電を掲載しています。*1

  • #request_extra()
    • 高頻度
  • #request_extra_long()
    • 長期
Earthquake and volcano (地震火山)

地震、火山に関する情報。毎分更新し、直近少なくとも10分入電を掲載しています。*1

  • request_eqvol()
    • 高頻度
  • request_eqvol_long()
    • 長期
Other (その他)

その他の情報。毎分更新し、直近少なくとも10分入電を掲載しています。*1

  • request_other()
    • 高頻度
  • request_other_long()
    • 長期
APIs

When you specify :object at :response_type, Obtain a Faraday::Response object.

  • #request_area_codes()
    • エリア一覧
  • #request_amedas_latest_time()
    • アメダス 最新時刻
  • #request_amedas_map()
    • アメダス(全国地図表示用)
  • #request_amedas_point()
    • アメダス(地点系)
  • #request_amedas_point_date()
    • アメダス(地点系)
  • #request_amedas_table()
    • アメダス観測所一覧
  • #request_amedas_selector_information()
    • アメダス配信データ 各要素の説明
  • #request_overview_forecast(n)
    • 天気概況(当日/翌日)
  • #request_forecast(n)
    • 天気予報
  • #request_warning()
    • エリア毎の注意報/警報
  • #request_himawari_fd()
    • ひまわり(フルディスク画像)の配信時刻
  • #request_himawari_jp()
    • ひまわり(日本付近画像)の配信時刻
  • #request_jmatile_n1()
    • レーダー実況の配信時刻
  • #request_jmatile_n2()
    • 降水ナウキャストの配信時刻
Retrieve the Feed details
  • #request_xml(url)
jma_client = JMA::Client.new.tap do |config|
	config.response_type = :object
end
jma_client.request_xml('http://www.data.jma.go.jp/developer/xml/data/20211229170106_0_VFVO52_400000.xml')

Development

Test

rspec spec

Contributing

Bug reports and pull requests are welcome on Bitbucket at https://bitbucket.org/routeflagsinc/jma. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Inspiration

Copyrights

*1 出典:気象庁ホームページ 気象庁防災情報XML - DATA GO JP

References

FAQs

Package last updated on 07 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc