module SalsaLabs

Constants

VERSION

Public Class Methods

configure() { |configuration| ... } click to toggle source

Configures the gem with your Salsa Labs credentials @note Configuration is required for the gem to function. @yieldparam [SalsaLabs::Configuration] config

yields gem's current +Configuration+ object within the block

@example

SalsaLabs.configure do |c|
  c.email    = 'myemail@example.com'
  c.password = 'mypassword'
end

@return [SalsaLabs] @see SalsaLabs::Configuration

# File lib/salsa_labs.rb, line 40
def self.configure
  yield configuration
end
request(path, query={}, &block) click to toggle source

Makes a request to the specified SalsaLabs API endpoint. @param [String] path

the url fragment that follows "+sandbox.salsalabs.com/api/+"
in the endpoint uri you are making a request to

@param [Hash] query

a hash representing the url query string parameters

@yieldreturn [SalsaLabs::ApiResponse]

the response object for the executed request

@return [SalsaLabs]

# File lib/salsa_labs.rb, line 53
def self.request(path, query={}, &block)
  connection.request(path, query, &block)
end

Private Class Methods

configuration() click to toggle source

@return [SalsaLabs::Configuration]

# File lib/salsa_labs.rb, line 60
def self.configuration
  @configuration ||= Configuration.new
end
connection() click to toggle source

@return [SalsaLabs::Connection]

# File lib/salsa_labs.rb, line 65
def self.connection
  @connection ||= establish_connection
end
establish_connection() click to toggle source

@return [SalsaLabs::Connection] @raise [ConfigurationError] if the gem has not been configured properly

# File lib/salsa_labs.rb, line 71
def self.establish_connection
  raise ConfigurationError.new unless configuration.valid?
  Connection.new(configuration.email, configuration.password)
end