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



138
139
140
141
142
# File 'lib/stockboy/providers/soap.rb', line 138

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



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

dsl_attr :endpoint

#headersHash

Hash of optional HTTP request headers

Examples:

headers "X-ClientKey" => "12345"

Returns:

  • (Hash)


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

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)


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

dsl_attr :message

#message_tagString

Message tag name

Examples:

message_tag "GetResult"

Returns:

  • (String)


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

dsl_attr :message_tag

#namespaceObject

Optional if specified in WSDL



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

dsl_attr :namespace

#namespace_idObject

Optional if specified in WSDL



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

dsl_attr :namespace_id

#namespacesObject

Optional if specified in WSDL



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

dsl_attr :namespaces

#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

#response_formatSymbol

Change the default response type, default :hash

Examples:

response_format :xml

Returns:

  • (Symbol)


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

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)


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

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)


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

dsl_attr :wsse_auth

Instance Method Details

#attributesHash

Examples:

attributes {}

Returns:

  • (Hash)


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

dsl_attr :attributes

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

Connection object to the configured SOAP endpoint

Yields:

Returns:

  • (Savon::Client)


148
149
150
151
152
# File 'lib/stockboy/providers/soap.rb', line 148

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

#env_namespaceSymbol

Examples:

env_namespace :soapenv

Returns:

  • (Symbol)


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

dsl_attr :env_namespace

#soap_actionString

Examples:

soap_action "urn:processMessage"

Returns:

  • (String)


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

dsl_attr :soap_action