Class: ExactTargetClient::ExactTargetSoapClient
- Inherits:
-
Object
- Object
- ExactTargetClient::ExactTargetSoapClient
- Defined in:
- lib/exact_target_client/exact_target_soap_client.rb
Constant Summary collapse
- RESPONSE_RESULT_KEYS =
{ create: :create_response, update: :update_response, delete: :delete_response, retrieve: :retrieve_response_msg }
Instance Attribute Summary collapse
-
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
-
#wsdl ⇒ Object
Returns the value of attribute wsdl.
Instance Method Summary collapse
- #create(object_type, properties) ⇒ Object
- #delete(object_type, properties) ⇒ Object
- #header ⇒ Object
-
#initialize {|_self| ... } ⇒ ExactTargetSoapClient
constructor
A new instance of ExactTargetSoapClient.
- #retrieve(object_type, properties, filter = nil) ⇒ Object
- #set_oauth_token(token) ⇒ Object
- #soap_client ⇒ Object
- #update(object_type, properties) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ ExactTargetSoapClient
Returns a new instance of ExactTargetSoapClient.
60 61 62 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 60 def initialize yield self if block_given? end |
Instance Attribute Details
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
51 52 53 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 51 def oauth_token @oauth_token end |
#wsdl ⇒ Object
Returns the value of attribute wsdl.
51 52 53 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 51 def wsdl @wsdl end |
Instance Method Details
#create(object_type, properties) ⇒ Object
107 108 109 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 107 def create(object_type, properties) soap_action :create, object_type, properties end |
#delete(object_type, properties) ⇒ Object
115 116 117 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 115 def delete(object_type, properties) soap_action :delete, object_type, properties end |
#header ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 64 def header raise ExactTargetClient::ExactTargetAPI::ClientException.new('OAuth token must be provided to SOAP client!') unless oauth_token { 'fueloauth' => oauth_token, '@xmlns' => 'http://exacttarget.com' } end |
#retrieve(object_type, properties, filter = nil) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 91 def retrieve(object_type, properties, filter = nil) raise ExactTargetClient::ExactTargetAPI::ClientException.new('Object properties must be specified') unless properties.present? payload = {'ObjectType' => object_type, 'Properties' => properties} if filter.present? values = Array.wrap(filter[:value]) payload['Filter'] = { '@xsi:type' => 'tns:SimpleFilterPart', 'Property' => filter[:property], 'SimpleOperator' => values.one? ? 'equals' : 'IN', 'Value' => values } end = {'RetrieveRequest' => payload} soap_request :retrieve, end |
#set_oauth_token(token) ⇒ Object
86 87 88 89 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 86 def set_oauth_token(token) @oauth_token = token soap_client.globals[:soap_header] = header end |
#soap_client ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 76 def soap_client @soap_client = Savon.client( soap_header: header, wsdl: wsdl, log: false, open_timeout: 120, read_timeout: 120 ) end |
#update(object_type, properties) ⇒ Object
111 112 113 |
# File 'lib/exact_target_client/exact_target_soap_client.rb', line 111 def update(object_type, properties) soap_action :update, object_type, properties end |