Module: Wego

Defined in:
lib/wego.rb,
lib/wego/client.rb,
lib/wego/result.rb,
lib/wego/search.rb,
lib/wego/booking.rb,
lib/wego/version.rb,
lib/wego/location.rb,
lib/wego/response.rb,
lib/wego/configuration.rb

Defined Under Namespace

Classes: Booking, Client, Configuration, Location, OpenStruct, Response, Result, Search

Constant Summary collapse

VERSION =
"0.2.0".freeze

Class Method Summary collapse

Class Method Details

.configurationObject


16
17
18
# File 'lib/wego/configuration.rb', line 16

def self.configuration
  @configuration ||= Configuration.new
end

.configuration=(config) ⇒ Object


20
21
22
# File 'lib/wego/configuration.rb', line 20

def self.configuration=(config)
  @configuration = config
end

.configure {|configuration| ... } ⇒ Object

Yields:


24
25
26
# File 'lib/wego/configuration.rb', line 24

def self.configure
  yield configuration
end

.format_date(date) ⇒ Object


17
18
19
# File 'lib/wego/search.rb', line 17

def self.format_date(date)
  DateTime.parse(date).strftime("%Y-%m-%d")
end

.get_resource(end_point, api_params = {}) ⇒ Object


34
35
36
37
38
39
# File 'lib/wego/client.rb', line 34

def self.get_resource(end_point, api_params = {})
  Wego::Response.parse_json(
    Client.new(end_point, api_params).get
  )
rescue RestClient::ResourceNotFound, RestClient::BadRequest
end