Giter Club home page Giter Club logo

skyscanner's Introduction

skyscanner

A Ruby wrapper for the Skyscanner API. See http://business.skyscanner.net/portal/en-GB/AffiliateNetwork and http://business.skyscanner.net/portal/en-GB/Documentation/Api for official documentation.

Installation

With Bundler

In your Gemfile, add the following line

gem 'skyscanner', :require => 'skyscanner'

Without Bundler

gem install skyscanner

Usage

At the moment the interface is very simple and it only supports the Browse Cache Service API. Feel free to submit pull requests for more features.

Each of the four endpoints can be accessed with a class method reflecting the endpoint's name.

Skyscanner::Connection.browse_dates
Skyscanner::Connection.browse_grid
Skyscanner::Connection.browse_routes
Skyscanner::Connection.browse_quotes
Skyscanner::Connection.site_redirect

Options can be passed in a hash to these methods and they will be included in the request.

## Example from: http://www.skyscanneraffiliate.net/portal/en-GB/US/BrowseCache/BrowseQuotes
Skyscanner::Connection.browse_quotes({ :country => "GB", :currency => "GBP", :locale => "en-GB", :originPlace => "UK", :destinationPlace => "anywhere", :outboundPartialDate => "anytime", :inboundPartialDate => "anytime" })
# => GET http://partners.api.skyscanner.net/apiservices/browsequotes/v1.0/GB/GBP/en-GB/UK/anywhere/anytime/anytime?apiKey=prtl6749387986743898559646983194

There are a number of class level options that can be overridden.

Skyscanner::Connection.apikey           # the default API Key
Skyscanner::Connection.adapter          # the Faraday adapter to use (default: :net_http)
Skyscanner::Connection.logger           # a Logger object for logging requests (default: nil)
Skyscanner::Connection.protocol         # http or https (default: :http)
Skyscanner::Connection.response_format  # ruby, json, jsonp or xml (default: ruby)
Skyscanner::Connection.url              # partners.api.skyscanner.net/apiservices/
Skyscanner::Connection.version          # v.10

Example:

Skyscanner::Connection.protocol
# => :http
Skyscanner::Connection.protocol = :https
# => :https

These options can also be overridden during instantiation of a Skyscanner::Connection

@secure = Skyscanner::Connection.new({:protocol => :https})

Copyright

Made for Soundtravel (http://soundtravel.co/).

Copyright (c) 2013 Alex Beregszaszi. See LICENSE for details.

Based on the SeatGeek Ruby API (https://github.com/bluefocus/seatgeek/) which is: Copyright (c) 2012 Dan Matthews / Ticket Evolution (http://ticketevolution.com)

skyscanner's People

Contributors

axic avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.