Module: IdentityMind

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

Defined Under Namespace

Modules: Account Classes: Entity, ResponseError

Constant Summary collapse

VERSION =
'0.1.0'.freeze

Class Method Summary collapse

Class Method Details

.configurationObject



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

def configuration
  @configuration ||= OpenStruct.new
end

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

Yields:



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

def configure
  yield(configuration)
  update_config
end

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

Raises:



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

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



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

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