Class: Stockboy::Providers::SOAP

Inherits:
Stockboy::Provider show all
Defined in:
lib/stockboy/providers/soap.rb

Overview

Fetch data from a SOAP endpoint

Backed by Savon gem, see savon for full configuration options: extra options are passed through.

Options collapse

Attributes inherited from Stockboy::Provider

#data, #data_time, #errors, #logger

Instance Method Summary collapse

Methods inherited from Stockboy::Provider

#clear, #inspect, logger, #reload, #valid?

Constructor Details

#initialize(opts = {}, &block) ⇒ SOAP

Initialize a new SOAP provider



78
79
80
81
# File 'lib/stockboy/providers/soap.rb', line 78

def initialize(opts={}, &block)
  super
  DSL.new(self).instance_eval(&block) if block_given?
end

Instance Attribute Details

#endpointObject

Optional if specified in WSDL



53
# File 'lib/stockboy/providers/soap.rb', line 53

dsl_attr :endpoint

#headersHash

Hash of optional HTTP request headers

Examples:

headers "X-ClientKey" => "12345"

Returns:

  • (Hash)


72
# File 'lib/stockboy/providers/soap.rb', line 72

dsl_attr :headers

#messageHash

Hash of message options passed in the request, often includes credentials and query options.

Examples:

message "clientId" => "12345", "updatedSince" => "2012-12-12"

Returns:

  • (Hash)


63
# File 'lib/stockboy/providers/soap.rb', line 63

dsl_attr :message

#namespaceObject

Optional if specified in WSDL



41
# File 'lib/stockboy/providers/soap.rb', line 41

dsl_attr :namespace

#namespace_idObject

Optional if specified in WSDL



47
# File 'lib/stockboy/providers/soap.rb', line 47

dsl_attr :namespace_id

#requestString

The name of the request, see your SOAP documentation

Examples:

request "allItemsDetails"

Returns:

  • (String)


35
# File 'lib/stockboy/providers/soap.rb', line 35

dsl_attr :request

#wsdlString

URL with the WSDL document

Examples:

wsdl "http://example.com/api/soap?wsdl"

Returns:

  • (String)


26
# File 'lib/stockboy/providers/soap.rb', line 26

dsl_attr :wsdl

Instance Method Details

#client {|@client| ... } ⇒ Savon::Client

Connection object to the configured SOAP endpoint

Yields:

Returns:

  • (Savon::Client)


87
88
89
90
91
# File 'lib/stockboy/providers/soap.rb', line 87

def client
  @client ||= Savon.client(client_options)
  return @client unless block_given?
  yield @client
end