Class: LouXewTey::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil, auth_key = nil) ⇒ Client

Returns a new instance of Client.



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

def initialize( api_key=nil,auth_key=nil )
  @api_key, @auth_key = api_key,auth_key
  connect( @api_key, @auth_key )
end

Instance Method Details

#create_event(event = {}) ⇒ Object



9
10
11
# File 'lib/louxewtey/client.rb', line 9

def create_event( event={} )
  return "c'est fait"
end

#get_list_of(args = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/louxewtey/client.rb', line 13

def get_list_of( args = {} )      
  return nil unless args[:resource]      
  resource = args[:resource].downcase
  format   = args[:format].nil? ? "xml" : args[:format].to_s
  type     = args[:type].nil? ? "" : "?type=#{args[:type].to_s}"
  type = "?genre=#{args[:resource]}" if args[:resource].downcase == "hotels"
  if %w(evenements hotels).include?( resource )
    RestClient.get("#{SERVEUR}/#{resource}.#{format}#{type}")do |response,request|
      return response.body if response.code.to_i == 200
    end
  end
  nil      
end