Class: KnuVerse::Knufactor::SimpleAPIClient

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

Overview

The Simple API Client class

Instance Attribute Summary

Attributes inherited from APIClientBase

#account, #apikey, #base_uri, #secret, #server

Instance Method Summary collapse

Methods inherited from APIClientBase

#about_service, #api_uri, #authenticated?, #configured?, #get, #json_headers, #patch, #post, #put, #refresh_auth, #refresh_auth_bearer

Methods included from Helpers::APIClient

#json_escape, #raw, #version

Methods included from Validations::APIClient

#validate_creds, #validate_opts, #validate_server

Constructor Details

#initialize(opts = {}) ⇒ SimpleAPIClient

Returns a new instance of SimpleAPIClient.



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

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

  # Set up the client's state
  @server     = opts[:server] || 'https://cloud.knuverse.com'
  @apikey     = opts[:apikey]
  @secret     = opts[:secret]
  @base_uri   = opts[:base_uri] || '/api/v1/'
  @last_auth  = nil
  @auth_token = nil
  @configured = true
end