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_size, #data_time, #errors, #logger

Options collapse

Instance Method Summary collapse

Methods inherited from Stockboy::Provider

#clear, #data?, #inspect, #reload, #valid?

Constructor Details

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

Initialize a new SOAP provider



156
157
158
159
160
# File 'lib/stockboy/providers/soap.rb', line 156

def initialize(opts={}, &block)
  super
  @response_format = opts[:response_format] || :hash
  DSL.new(self).instance_eval(&block) if block_given?
end

Instance Attribute Details

#endpointObject

Optional if specified in WSDL



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

dsl_attr :endpoint

#headersHash

Hash of optional HTTP request headers

Examples:

headers "X-ClientKey" => "12345"

Returns:

  • (Hash)


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

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)


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

dsl_attr :message

#message_tagString

Message tag name

Examples:

message_tag "GetResult"

Returns:

  • (String)


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

dsl_attr :message_tag

#namespaceObject

Optional if specified in WSDL



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

dsl_attr :namespace

#namespace_idObject

Optional if specified in WSDL



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

dsl_attr :namespace_id

#namespacesObject

Optional if specified in WSDL



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

dsl_attr :namespaces

#open_timeoutInteger

Maximum time to establish a connection

Examples:

open_timeout 10

Returns:

  • (Integer)


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

dsl_attr :open_timeout

#read_timeoutInteger

Maximum time to read data from connection

Examples:

read_timeout 10

Returns:

  • (Integer)


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

dsl_attr :read_timeout

#requestString

The name of the request, see your SOAP documentation

Examples:

request "allItemsDetails"

Returns:

  • (String)


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

dsl_attr :request

#response_formatSymbol

Change the default response type, default :hash

Examples:

response_format :xml

Returns:

  • (Symbol)


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

dsl_attr :response_format

#soap_headerString

XML string to override the Soap headers

Examples:

soap_header "<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">..."

Returns:

  • (String)


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

dsl_attr :soap_header

#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

#wsse_authArray

Array of WSSE Auth values

Examples:

wsse_auth ["Username", "Password"]

Returns:

  • (Array)


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

dsl_attr :wsse_auth

Instance Method Details

#attributesHash

Examples:

attributes {}

Returns:

  • (Hash)


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

dsl_attr :attributes

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

Connection object to the configured SOAP endpoint

Yields:

Returns:

  • (Savon::Client)


166
167
168
169
170
171
172
# File 'lib/stockboy/providers/soap.rb', line 166

def client
  @client ||= Savon.client(client_options)
  @client.globals.open_timeout(open_timeout) if open_timeout
  @client.globals.read_timeout(read_timeout) if read_timeout
  yield @client if block_given?
  @client
end

#env_namespaceSymbol

Examples:

env_namespace :soapenv

Returns:

  • (Symbol)


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

dsl_attr :env_namespace

#soap_actionString

Examples:

soap_action "urn:processMessage"

Returns:

  • (String)


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

dsl_attr :soap_action