Module: HostConnect

Extended by:
HostConnect
Included in:
HostConnect
Defined in:
lib/hostconnect.rb,
lib/hostconnect/client.rb,
lib/hostconnect/builder.rb,
lib/hostconnect/coercion.rb,
lib/hostconnect/response.rb,
lib/hostconnect/translation.rb,
lib/hostconnect/rtf_document.rb,
lib/hostconnect/responses/ping.rb,
lib/hostconnect/responses/agent_info.rb,
lib/hostconnect/builders/ping_builder.rb,
lib/hostconnect/responses/add_service.rb,
lib/hostconnect/responses/get_booking.rb,
lib/hostconnect/responses/option_info.rb,
lib/hostconnect/responses/get_services.rb,
lib/hostconnect/responses/get_locations.rb,
lib/hostconnect/responses/list_bookings.rb,
lib/hostconnect/responses/supplier_info.rb,
lib/hostconnect/builders/agent_info_builder.rb,
lib/hostconnect/builders/add_service_builder.rb,
lib/hostconnect/builders/get_booking_builder.rb,
lib/hostconnect/builders/option_info_builder.rb,
lib/hostconnect/builders/pax_details_builder.rb,
lib/hostconnect/builders/room_config_builder.rb,
lib/hostconnect/builders/get_services_builder.rb,
lib/hostconnect/builders/suppler_info_builder.rb,
lib/hostconnect/responses/get_system_settings.rb,
lib/hostconnect/builders/get_locations_builder.rb,
lib/hostconnect/builders/list_bookings_builder.rb,
lib/hostconnect/responses/record_booking_payment.rb,
lib/hostconnect/builders/new_booking_info_builder.rb,
lib/hostconnect/builders/service_line_note_builder.rb,
lib/hostconnect/builders/get_system_settings_builder.rb,
lib/hostconnect/responses/get_booking_payment_summary.rb,
lib/hostconnect/builders/record_booking_payment_builder.rb,
lib/hostconnect/builders/get_booking_payment_summary_builder.rb

Defined Under Namespace

Modules: Version Classes: AbstractBuilder, AbstractResponse, AddService, AddServiceBuilder, AgentInfo, AgentInfoBuilder, Client, Coercion, GetBooking, GetBookingBuilder, GetBookingPaymentSummary, GetBookingPaymentSummaryBuilder, GetLocations, GetLocationsBuilder, GetServices, GetServicesBuilder, GetSystemSettings, GetSystemSettingsBuilder, ListBookings, ListBookingsBuilder, NewBookingInfoBuilder, OptionInfo, OptionInfoBuilder, PaxDetailsBuilder, Ping, PingBuilder, RecordBookingPayment, RecordBookingPaymentBuilder, RoomConfigBuilder, RtfDocument, ServiceLineNoteBuilder, SupplierInfo, SupplierInfoBuilder, Translation

Instance Method Summary collapse

Instance Method Details

#configObject



54
55
56
# File 'lib/hostconnect.rb', line 54

def config
  @@config
end

#loggerObject



58
59
60
# File 'lib/hostconnect.rb', line 58

def logger
  @@logger
end

#setup(env, config) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/hostconnect.rb', line 35

def setup(env, config)
  config[:dtd] =
    'http://www.tourplan.com/support/Connector/hostConnect_' + config[:version] + '.dtd'
  @@config = OpenStruct.new config

  log_level = case env
              when :test         then Logger::WARN
              when :development  then Logger::DEBUG
              when :production   then Logger::ERROR
              else               raise ArgumentError, 'Incorrect environment: ' + env.to_s
              end

  log_path = config[:log_path] || "log/"
  @@logger = Logger.new(log_path + env.to_s + ".log")
  @@logger.level = log_level
  @@logger.formatter = Logger::Formatter.new
  @@logger.datetime_format = "%Y-%d-%m %H:%M:%S"
end