https://github.com/mikhailvs/kiwi-api
Ruby wrapper for kiwi.com API
https://github.com/mikhailvs/kiwi-api
Last synced: about 1 month ago
JSON representation
Ruby wrapper for kiwi.com API
- Host: GitHub
- URL: https://github.com/mikhailvs/kiwi-api
- Owner: mikhailvs
- Created: 2019-09-05T01:21:21.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-05T01:21:50.000Z (almost 7 years ago)
- Last Synced: 2025-03-16T11:44:26.974Z (over 1 year ago)
- Language: Ruby
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kiwi-api
Ruby bindings for the Kiwi.com API.
## Install
```ruby
git_source(:gitlab) { |repo_name| "https://gitlab.com/#{repo_name}.git" }
gem 'kiwi-api', gitlab: 'mikhailvs/kiwi-ruby'
````
## Use
```ruby
require 'kiwi/api'
flights = Kiwi::API::Flights.new(
partner: 'picky',
currency: 'USD',
locale: 'en-US'
)
locations = Kiwi::API::Locations.new
dates = Date.parse('1 Jan 2019')..Date.parse('10 Sep 2019')
result = flights.search(
from: locations.city('washington d.c.').first.code,
to: locations.country('france').first.code,
limit: 10,
depart: dates,
return: dates,
nights: 10..15
).data.first
info = {
to: result.cityTo,
from: result.cityFrom,
price: result.price,
distance: result.distance,
flight_time: result.fly_duration,
leave: Time.at(result.dTime)
}
puts info.inspect
```