Module: TLAW

Defined in:
lib/tlaw.rb,
lib/tlaw/api.rb,
lib/tlaw/dsl.rb,
lib/tlaw/util.rb,
lib/tlaw/param.rb,
lib/tlaw/version.rb,
lib/tlaw/api_path.rb,
lib/tlaw/endpoint.rb,
lib/tlaw/namespace.rb,
lib/tlaw/param_set.rb,
lib/tlaw/data_table.rb,
lib/tlaw/param/type.rb,
lib/tlaw/response_processor.rb

Overview

TLAW is a framework for creating API wrappers for get-only APIs (like weather, geonames and so on) or subsets of APIs (like getting data from Twitter).

Short example:

# Definition:
class OpenWeatherMap < TLAW::API
  param :appid, required: true

  namespace :current, '/weather' do
    endpoint :city, '?q={city}{,country_code}' do
      param :city, required: true
    end
  end
end

# Usage:
api = OpenWeatherMap.new(appid: '<yourappid>')
api.current.weather('Kharkiv')
# => {"weather.main"=>"Clear",
#  "weather.description"=>"clear sky",
#  "main.temp"=>8,
#  "main.pressure"=>1016,
#  "main.humidity"=>81,
#  "dt"=>2016-09-19 08:30:00 +0300,
#  ...}

Refer to README for reasoning about why you need it and links to more detailed demos, or start reading YARD docs from API and DSL modules.

Defined Under Namespace

Modules: DSL, Util Classes: API, APIPath, DataTable, Endpoint, Namespace, Param, ParamSet

Constant Summary collapse

MAJOR =
0
MINOR =
0
PATCH =
2
VERSION =
[MAJOR, MINOR, PATCH].join('.')