Class: NdsApi::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ NdsApi::Client

Create a new client instance

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :user (String)

    NDS User

  • :password (String)

    NDS Password

  • :agency_key (String)

    NDS Agency Key

  • :debug (Boolean)


20
21
22
23
24
# File 'lib/nds_api.rb', line 20

def initialize(options = {})
  @options = options.dup
  @http = NdsApi::Http.new(options)
  @url = NdsApi::Url.new(options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/nds_api.rb', line 26

def method_missing(method, *args, &block)
  @method = NdsApi::Method.new(method)
  @args = *args

  validate_search_providers_params!

  console_debug(step: 1)
  @response = http_action(method, *args, &block)
  console_debug(step: 2)
  NdsApi::Utils.hash_keys_str_to_sym(@response)
end