Module: Attune

Defined in:
lib/attune/net_http_persistent.rb,
lib/attune.rb,
lib/attune/gzip.rb,
lib/attune/mocks.rb,
lib/attune/client.rb,
lib/attune/default.rb,
lib/attune/version.rb,
lib/attune/json_logger.rb,
lib/attune/api/entities.rb,
lib/attune/configurable.rb,
lib/attune/api/anonymous.rb,
lib/attune/call_dropping.rb,
lib/attune/models/customer.rb,
lib/attune/param_flattener.rb,
lib/attune/models/blacklist.rb,
lib/attune/models/scope_entry.rb,
lib/attune/models/ranking_params.rb,
lib/attune/models/ranked_entities.rb,
lib/attune/models/anonymous_result.rb,
lib/attune/models/blacklist_params.rb,
lib/attune/models/batch_ranking_result.rb,
lib/attune/models/batch_ranking_request.rb,
lib/attune/models/blacklist_get_response.rb,
lib/attune/models/blacklist_save_response.rb,
lib/attune/models/blacklist_delete_response.rb,
lib/attune/models/blacklist_update_response.rb

Overview

Hack NetHttpPersistent adapter to allow passing for env options We need this so we can pass in an option for idle_timout, until this is resolved https://github.com/lostisland/faraday/issues/262

Defined Under Namespace

Modules: Api, Configurable, Default, Model Classes: AuthenticationException, CallDropping, Client, DisabledException, Gzip, JsonLogger, NetHttpPersistent, ParamFlattener

Constant Summary collapse

MOCKS =
{
  'Anonymous.create' => Proc.new{ |body| {:id => SecureRandom.uuid } },
  'Entities.get_rankings' => Proc.new{ |body| { :ranking => body.ids.map(&:to_s) } },
  'Entities.batch_get_rankings' => Proc.new{ |body|
      { :results =>  body.requests.map {
          |params| { :ranking => params.ids.map(&:to_s) }
      } }
  }
}
VERSION =
"1.0.21"

Class Method Summary collapse

Class Method Details

.clientObject



25
26
27
# File 'lib/attune.rb', line 25

def self.client
  Client.new
end

.configure(&block) ⇒ Object



38
39
40
# File 'lib/attune.rb', line 38

def self.configure(&block)
  Default.configure(&block)
end

.test_mode!Object

Simulate all API calls This is equivalent to setting disabled to true and exception_handler to :mock



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

def self.test_mode!
  configure do |c|
    c.exception_handler = :mock
    c.disabled = true
  end
end