Class: Elong::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/elong/client.rb

Overview

Elong Client Class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, appKey, secretKey, opts = {}) ⇒ Elong::Client

Instantiate a new Elong API client using the user, appKey and secretKey registered to your application

Parameters:

  • user (String)

    the user value

  • appKey (String)

    the appKey value

  • secretKey (String)

    the secretKey value

  • opts (String) (defaults to: {})

    :domain elong api url (default: ‘api.elong.com/rest’)

  • opts (String) (defaults to: {})

    :version the version of elong api version (default: ‘1.0’)

  • opts (String) (defaults to: {})

    :local the data return language (ONLY ‘en_US’ and ‘zn_CN’, default: ‘zh_CN’)

  • opts (String) (defaults to: {})

    :format the data return foramat (ONLY ‘json’ and ‘xml’, default: ‘json’)



18
19
20
# File 'lib/elong/client.rb', line 18

def initialize(user, appKey, secretKey, opts={})
  @request = Elong::Request.new(user, appKey, secretKey, opts)
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



4
5
6
# File 'lib/elong/client.rb', line 4

def request
  @request
end

Instance Method Details

#commonElong::API::Common::Core

The Common section



39
40
41
# File 'lib/elong/client.rb', line 39

def common
  @common ||= Elong::API::Common::Core.new(self)
end

#ghotelElong::API::GHotel::Core

The Globel Hotel section



32
33
34
# File 'lib/elong/client.rb', line 32

def ghotel
  @ghotel ||= Elong::API::GHotel::Core.new(self)
end

#hotelElong::API::Hotel::Core

The Hotel section



25
26
27
# File 'lib/elong/client.rb', line 25

def hotel
  @hotel ||= Elong::API::Hotel::Core.new(self)
end