Module: QuestBack

Extended by:
ActiveSupport::Autoload
Defined in:
lib/quest_back.rb,
lib/quest_back/api.rb,
lib/quest_back/error.rb,
lib/quest_back/version.rb,
lib/quest_back/response.rb,
lib/quest_back/configuration.rb,
lib/quest_back/debug_observer.rb

Defined Under Namespace

Classes: Api, Configuration, DebugObserver, Error, Response

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.conf!Object

:nodoc:

Read config from file, just makes it easy for me to spin up a console, read API credentials and get going



31
32
33
# File 'lib/quest_back.rb', line 31

def self.conf!
  read_default_configuration_from_file 'config.yml'
end

.debug!Object

:nodoc:

Injects a debug observer which hijacks requests so we don’t send anything. We’ll pretty print the SOAP body for inspection.



39
40
41
42
# File 'lib/quest_back.rb', line 39

def self.debug!
  remove_debug!
  Savon.observers << DebugObserver.new
end

.read_default_configuration_from_file(pathname) ⇒ Object

:nodoc:



52
53
54
55
56
# File 'lib/quest_back.rb', line 52

def self.read_default_configuration_from_file(pathname)
  path = Pathname.new pathname
  path = Pathname.new [Dir.pwd, pathname].join('/') unless path.absolute?
  self.default_configuration = Configuration.new YAML.load_file(path)
end

.remove_debug!Object

:nodoc:

Removes any debug observers.



47
48
49
# File 'lib/quest_back.rb', line 47

def self.remove_debug!
  Savon.observers.delete_if { |observer| observer.is_a? DebugObserver }
end