Class: EBICheck::Client

Inherits:
HTTPClients::BaseClient show all
Defined in:
lib/ebi_check/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options) ⇒ Client

Initializes a new EBICheck::Client instance.

Parameters:

  • url (String)

    The base URL for the service

  • options (Hash)

    Options including user credentials

Options Hash (options):

  • :user (String)

    The username for basic authentication.

  • :password (String)

    The password for basic authentication.



36
37
38
39
40
# File 'lib/ebi_check/client.rb', line 36

def initialize(url, options)
  super()
  @url = File.join(url, '/') # Add trailing slash
  @options = options
end

Class Method Details

.for_ega_samplesEBICheck::Client

Creates a client for accessing EGA sample data.

Returns:



74
75
76
# File 'lib/ebi_check/client.rb', line 74

def for_ega_samples
  new(samples_url, ega_options)
end

.for_ega_studiesEBICheck::Client

Creates a client for accessing EGA study data.

Returns:



80
81
82
# File 'lib/ebi_check/client.rb', line 80

def for_ega_studies
  new(studies_url, ega_options)
end

.for_ena_samplesEBICheck::Client

Creates a client for accessing ENA sample data.

Returns:



92
93
94
# File 'lib/ebi_check/client.rb', line 92

def for_ena_samples
  new(samples_url, ena_options)
end

.for_ena_studiesEBICheck::Client

Creates a client for accessing ENA study data.

Returns:



86
87
88
# File 'lib/ebi_check/client.rb', line 86

def for_ena_studies
  new(studies_url, ena_options)
end

Instance Method Details

#inspectString

Returns a string representation of the client instance with sensitive information (such as the password) redacted.

Returns:

  • (String)

    The inspected client object with filtered credentials.



47
48
49
50
51
# File 'lib/ebi_check/client.rb', line 47

def inspect
  redacted_options = options.dup
  redacted_options[:password] = '[FILTERED]' if redacted_options.key?(:password)
  "#<#{self.class}:0x#{object_id.to_s(16)} @options=#{redacted_options.inspect} @url=#{@url.inspect}>"
end