Class: Kasabi::Status

Inherits:
BaseClient show all
Defined in:
lib/kasabi/api/status.rb

Instance Attribute Summary

Attributes inherited from BaseClient

#apikey, #client, #endpoint

Instance Method Summary collapse

Methods inherited from BaseClient

#client_options, #get, #post, #validate_response

Constructor Details

#initialize(endpoint, options = {}) ⇒ Status

Initialize the store client to work with a specific endpoint

The options hash can contain the following values:

  • :apikey: required. apikey authorized to use the API

  • :client: HTTPClient object instance



9
10
11
# File 'lib/kasabi/api/status.rb', line 9

def initialize(endpoint, options={})
  super(endpoint, options)
end

Instance Method Details

#get_statusObject



13
14
15
16
17
# File 'lib/kasabi/api/status.rb', line 13

def get_status()
  response = get(@endpoint)
  validate_response(response)
  return JSON.parse( response.content )        
end

#published?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/kasabi/api/status.rb', line 27

def published?
  return status() == "published"
end

#statusObject



19
20
21
# File 'lib/kasabi/api/status.rb', line 19

def status
  return get_status()["status"]
end

#storage_modeObject



23
24
25
# File 'lib/kasabi/api/status.rb', line 23

def storage_mode
  return get_status()["storageMode"]
end

#writeable?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/kasabi/api/status.rb', line 31

def writeable?
  return storage_mode() == "read-write"
end