Class: SkullIsland::SimpleAPIClient

Inherits:
APIClientBase show all
Defined in:
lib/skull_island/simple_api_client.rb

Overview

The Simple API Client class

Instance Attribute Summary

Attributes inherited from APIClientBase

#base_uri, #password, #server, #username

Instance Method Summary collapse

Methods inherited from APIClientBase

#api_uri, #authenticated?, #configured?, #delete, #get, #json_headers, #patch, #post, #put

Methods included from Helpers::APIClient

#about_service, #cache, #invalidate_cache_for, #json_escape, #lru_cache, #raw, #server_status, #version

Methods included from Validations::APIClient

#validate_creds, #validate_opts, #validate_server

Constructor Details

#initialize(opts = {}) ⇒ SimpleAPIClient

Returns a new instance of SimpleAPIClient.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/skull_island/simple_api_client.rb', line 6

def initialize(opts = {})
  # validations
  validate_opts(opts)

  # Set up the client's state
  @server     = opts[:server] || 'http://localhost:8001'
  @username   = opts[:username]
  @password   = opts[:password]
  @cache      = LRUCache.new(size: 1000) # LRU cache of up to 1000 items
  @configured = true
end