Module: IdentityMind

Includes:
HTTParty
Defined in:
lib/identity_mind.rb,
lib/identity_mind/entity.rb,
lib/identity_mind/params.rb,
lib/identity_mind/account.rb,
lib/identity_mind/version.rb,
lib/identity_mind/response_error.rb

Defined Under Namespace

Modules: Account Classes: Entity, Params, ResponseError

Constant Summary collapse

VERSION =
'0.2.4'.freeze

Class Method Summary collapse

Class Method Details

.configurationObject



16
17
18
# File 'lib/identity_mind.rb', line 16

def configuration
  @configuration ||= OpenStruct.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



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

def configure
  yield(configuration)
  update_config
end

.load_default_configurationObject



31
32
33
34
35
36
37
# File 'lib/identity_mind.rb', line 31

def load_default_configuration
  @configuration = nil
  configure do |config|
    config.base_uri = 'https://edna.identitymind.com'
    config.param_length_limit = 128
  end
end

.perform_request(http_method, path, options, &block) ⇒ Object

Raises:



39
40
41
42
43
44
# File 'lib/identity_mind.rb', line 39

def perform_request(http_method, path, options, &block)
  result = super
  return result if result.success?

  raise ResponseError.new(result.body, result.code)
end

.update_configObject



25
26
27
28
29
# File 'lib/identity_mind.rb', line 25

def update_config
  base_uri configuration.base_uri
  basic_auth configuration.user, configuration.password
  true
end