Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/emsk/resas_kit

Ruby wrapper for the RESAS API.
https://github.com/emsk/resas_kit

api-client gem resas ruby

Last synced: about 1 month ago
JSON representation

Ruby wrapper for the RESAS API.

Awesome Lists containing this project

README

        

# ResasKit

[![Gem Version](https://badge.fury.io/rb/resas_kit.svg)](https://badge.fury.io/rb/resas_kit)
[![Build Status](https://github.com/emsk/resas_kit/actions/workflows/build.yml/badge.svg)](https://github.com/emsk/resas_kit/actions/workflows/build.yml)
[![Build Status](https://travis-ci.org/emsk/resas_kit.svg?branch=main)](https://travis-ci.org/emsk/resas_kit)
[![Build status](https://ci.appveyor.com/api/projects/status/fovsqoa5omgfsard?svg=true)](https://ci.appveyor.com/project/emsk/resas-kit)
[![Build Status](https://dev.azure.com/emsk/resas_kit/_apis/build/status/emsk.resas_kit?branchName=main)](https://dev.azure.com/emsk/resas_kit/_build/latest?definitionId=6&branchName=main)
[![Codecov](https://codecov.io/gh/emsk/resas_kit/branch/main/graph/badge.svg)](https://codecov.io/gh/emsk/resas_kit)
[![Code Climate](https://codeclimate.com/github/emsk/resas_kit/badges/gpa.svg)](https://codeclimate.com/github/emsk/resas_kit)
[![Inline docs](http://inch-ci.org/github/emsk/resas_kit.svg?branch=main)](http://inch-ci.org/github/emsk/resas_kit)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)

Ruby wrapper for the [RESAS API](https://opendata.resas-portal.go.jp).

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'resas_kit'
```

And then execute:

```sh
$ bundle
```

Or install it yourself as:

```sh
$ gem install resas_kit
```

## Usage

```ruby
require 'resas_kit'

client = ResasKit::Client.new(api_key: '1234567890ABCDEFGHIJ1234567890abcdefghij')

response = client.get('prefectures')
response.body # get body
response.headers # get headers
response.status # get status

client.get('tourism/foreigners/forFrom', year: 2016, pref_code: '32', purpose: 2, add_area: '31,33') # underscored key
client.get('tourism/foreigners/forFrom', year: 2016, prefCode: '32', purpose: 2, addArea: '31,33') # camelized key
client.get_tourism__foreigners__for_from(year: 2016, pref_code: '32', purpose: 2, add_area: '31,33') # ghost method

client.get('prefectures').body.result[0].pref_name # method chaining
```

## ENV

| ENV Variable | Description |
| :----------- | :---------- |
| `RESAS_API_KEY` | Your RESAS API KEY |
| `RESAS_API_VERSION` | Target RESAS API VERSION |

You can create instance more easily.

```ruby
client = ResasKit::Client.new
```

## Supported RESAS API Version

ResasKit supports RESAS API [v1](https://opendata.resas-portal.go.jp/docs/api/v1/index.html).

ResasKit's API documentation is [here](http://www.rubydoc.info/gems/resas_kit).

## Supported Ruby Versions

Ruby 2.0.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7

## Contributing

1. Fork it ( https://github.com/emsk/resas_kit/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## License

[MIT](LICENSE.txt)