Module: FuelSDK::Soap
Instance Attribute Summary collapse
-
#debug ⇒ Object
, :internal_token.
-
#wsdl ⇒ Object
, :internal_token.
Attributes included from Targeting
Instance Method Summary collapse
- #header ⇒ Object
- #soap_client ⇒ Object
- #soap_configure(object_type, action, properties) ⇒ Object
- #soap_delete(object_type, properties) ⇒ Object
- #soap_describe(object_type) ⇒ Object
- #soap_get(object_type, properties = nil, filter = nil) ⇒ Object
- #soap_patch(object_type, properties) ⇒ Object
- #soap_perform(object_type, action, properties) ⇒ Object
- #soap_post(object_type, properties) ⇒ Object
- #soap_put(object_type, properties) ⇒ Object
Instance Attribute Details
#debug ⇒ Object
, :internal_token
117 118 119 |
# File 'lib/fuelsdk/soap.rb', line 117 def debug @debug end |
#wsdl ⇒ Object
, :internal_token
117 118 119 |
# File 'lib/fuelsdk/soap.rb', line 117 def wsdl @wsdl end |
Instance Method Details
#header ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/fuelsdk/soap.rb', line 121 def header raise 'Require legacy token for soap header' unless internal_token { 'oAuth' => {'oAuthToken' => internal_token}, :attributes! => { 'oAuth' => { 'xmlns' => 'http://exacttarget.com' }} } end |
#soap_client ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/fuelsdk/soap.rb', line 137 def soap_client self.refresh @soap_client = Savon.client( soap_header: header, wsdl: wsdl, endpoint: endpoint, wsse_auth: ["*", "*"], raise_errors: false, log: debug, open_timeout:180, read_timeout: 180 ) end |
#soap_configure(object_type, action, properties) ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/fuelsdk/soap.rb', line 172 def soap_configure object_type, action, properties = {} ['Action'] = action ['Configurations'] = {} if properties.is_a? Array then ['Configurations']['Configuration'] = [] properties.each do |configItem| ['Configurations']['Configuration'] << configItem end else ['Configurations'] = {'Configuration' => properties} end ['Configurations'][:attributes!] = { 'Configuration' => { 'xsi:type' => ('tns:' + object_type) }} soap_request :configure, end |
#soap_delete(object_type, properties) ⇒ Object
230 231 232 |
# File 'lib/fuelsdk/soap.rb', line 230 def soap_delete object_type, properties soap_cud :delete, object_type, properties end |
#soap_describe(object_type) ⇒ Object
151 152 153 154 155 156 157 158 159 160 |
# File 'lib/fuelsdk/soap.rb', line 151 def soap_describe object_type = { 'DescribeRequests' => { 'ObjectDefinitionRequest' => { 'ObjectType' => object_type } } } soap_request :describe, end |
#soap_get(object_type, properties = nil, filter = nil) ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/fuelsdk/soap.rb', line 189 def soap_get object_type, properties=nil, filter=nil if properties.nil? or properties.empty? rsp = soap_describe object_type if rsp.success? properties = rsp.retrievable else rsp.instance_variable_set(:@message, "Unable to get #{object_type}") # back door update return rsp end elsif properties.kind_of? Hash properties = properties.keys elsif properties.kind_of? String properties = [properties] end = {'ObjectType' => object_type, 'Properties' => properties} if filter and filter.kind_of? Hash ['Filter'] = filter [:attributes!] = { 'Filter' => { 'xsi:type' => 'tns:SimpleFilterPart' } } if filter.has_key?('LogicalOperator') [:attributes!] = { 'Filter' => { 'xsi:type' => 'tns:ComplexFilterPart' }} ['Filter'][:attributes!] = { 'LeftOperand' => { 'xsi:type' => 'tns:SimpleFilterPart' }, 'RightOperand' => { 'xsi:type' => 'tns:SimpleFilterPart' }} end end = {'RetrieveRequest' => } soap_request :retrieve, end |
#soap_patch(object_type, properties) ⇒ Object
226 227 228 |
# File 'lib/fuelsdk/soap.rb', line 226 def soap_patch object_type, properties soap_cud :update, object_type, properties end |
#soap_perform(object_type, action, properties) ⇒ Object
162 163 164 165 166 167 168 169 |
# File 'lib/fuelsdk/soap.rb', line 162 def soap_perform object_type, action, properties = {} ['Action'] = action ['Definitions'] = {'Definition' => properties} ['Definitions'][:attributes!] = { 'Definition' => { 'xsi:type' => ('tns:' + object_type) }} soap_request :perform, end |
#soap_post(object_type, properties) ⇒ Object
222 223 224 |
# File 'lib/fuelsdk/soap.rb', line 222 def soap_post object_type, properties soap_cud :create, object_type, properties end |
#soap_put(object_type, properties) ⇒ Object
234 235 236 |
# File 'lib/fuelsdk/soap.rb', line 234 def soap_put object_type, properties soap_cud :update, object_type, properties, true end |