class MarketoAPI::Client

The client to the Marketo SOAP API.

Constants

DEFAULT_CONFIG

Attributes

api_version[R]

The targeted Marketo SOAP API version.

campaigns[R]

The MarketoAPI::Campaigns instance using this Client.

endpoint[R]

The computed endpoint for Marketo.

error[R]

If the most recent call resulted in an exception, it will be captured here.

leads[R]

The MarketoAPI::Leads instance using this Client.

lists[R]

The MarketoAPI::Lists instance using this Client.

logger[W]

Sets the logger.

mobjects[R]

The MarketoAPI::MObjects instance using this Client.

subdomain[R]

The subdomain for interacting with Marketo.

wsdl[R]

The WSDL used for interacting with Marketo.

Public Class Methods

new(config = {}) click to toggle source

Creates a client to talk to the Marketo SOAP API.

Required Configuration Parameters

The required configuration parameters can be found in your Marketo dashboard, under Admin / Integration / SOAP API.

api_subdomain

The endpoint subdomain.

api_version

The endpoint version.

user_id

The user iD for SOAP integration.

encryption_key

The encryption key for SOAP integration.

Version 1.0 will make these values defaultable through environment variables.

Savon Configuration Parameters

These affect how Savon interacts with the HTTP server.

read_timeout

The timeout for reading from the server. Defaults to 90.

open_timeout

The timeout for opening the connection. Defaults to 90.

pretty_print_xml

How the SOAP XML should be written. Defaults to true.

ssl_verify_mode

How to verify SSL keys. This version defaults to none. Version 1.0 will default to normal verification.

headers

Headers to use. Defaults to Connection: Keep-Alive. Version 1.0 will enforce at least this value.

Version 1.0 will require that these options be provided under a savon key.

# File lib/marketo_api/client.rb, line 77
def initialize(config = {})
  config = DEFAULT_CONFIG.merge(config)
  @api_version = config.delete(:api_version).freeze
  @subdomain = config.delete(:api_subdomain).freeze

  @logger = config.delete(:logger)

  user_id = config.delete(:user_id)
  encryption_key = config.delete(:encryption_key)
  @auth = AuthHeader.new(user_id, encryption_key)

  @wsdl = "http://app.marketo.com/soap/mktows/#{api_version}?WSDL".freeze
  @endpoint = "https://#{subdomain}.mktoapi.com/soap/mktows/#{api_version}".freeze
  @savon = Savon.client(config.merge(wsdl: wsdl, endpoint: endpoint))
end

Public Instance Methods

error?() click to toggle source

Indicates the presence of an error from the last call.

# File lib/marketo_api/client.rb, line 94
def error?
  !!@error
end