exactly 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZDA4NGVlZWU5YTEzNDdhYmQyYmEyYWU3MDkwMTBhMjI2ZWQ5NzYwYQ==
5
+ data.tar.gz: !binary |-
6
+ Njk3YzVlMDU2N2UwNWQ5MTVkNjI0M2VmODU4YWUzNDUwODY0OTczMg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDRjZmNmNjVjNzdkMGM4Mzc0MTEzNzRkYTY1OWRkZGIzNWFmOWY5ZGI0ZjE1
10
+ MjQyNDk1NGZhN2Y0NTVjZDFlZWE2NDZjNDE2NjBlMjMxNzAxNWY1NGFkMmYw
11
+ NDE3YzAwNWQ5NzZjMzRjNGJlNDA0N2EwNzkyYjkwNDE4ZmFjYmM=
12
+ data.tar.gz: !binary |-
13
+ NzZiZDEzMTQ3MjYzYTZkNDhjOTZlZmExMjcwOTJjNzA4NDFlZDEzMWZhNjQy
14
+ NWMzMWQ5NGU3NTBiMTQwNjQ4ZGUxMzQxMGNhMWU5NTllNTZkN2FjOGZjZGZk
15
+ MjM3NTllNDcyMzk5MGU3MTU1Njk5YTUzYmIzMTA0YzRkYTNlZDc=
data/exactly.gemspec CHANGED
@@ -14,6 +14,6 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "exactly"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Exactly::VERSION
17
- gem.add_dependency "savon", "0.9.5"
17
+ gem.add_dependency "savon", "~> 2.2"
18
18
  gem.add_development_dependency "rake"
19
19
  end
@@ -26,17 +26,22 @@ module Exactly
26
26
 
27
27
  class Client
28
28
  def initialize(username, password)
29
- client.wsse.credentials username, password
29
+ @username = username
30
+ @password = password
30
31
  end
31
32
 
32
33
  def client
33
- @client ||= ::Savon::Client.new("https://webservice.s6.exacttarget.com/etframework.wsdl")
34
+ @client ||= ::Savon.client(:wsse_auth => [@username,@password]) do
35
+ wsdl "https://webservice.s6.exacttarget.com/etframework.wsdl"
36
+ namespace "http://exacttarget.com/wsdl/partnerAPI"
37
+ end
34
38
  end
35
39
 
36
40
  def upsert_subscriber(customer_key, email, lists = [])
37
- response = client.request "CreateRequest", :xmlns => "http://exacttarget.com/wsdl/partnerAPI" do
38
- http.headers['SOAPAction'] = 'Create'
39
- body = {
41
+ response = client.call(
42
+ :create,
43
+ :soap_action => "Create",
44
+ :message => {
40
45
  "Options" => {
41
46
  "SaveOptions" => [
42
47
  "SaveOption" => {
@@ -52,22 +57,49 @@ module Exactly
52
57
  { "ID" => list_id, "Status" => "Active" }
53
58
  }
54
59
  },
55
- :attributes! => { "Objects" => { "xsi:type" => "Subscriber" }}
56
- }
57
-
58
- soap.body = body
60
+ :attributes! => {"Objects" =>{ "xsi:type" => "tns:Subscriber" }}
61
+ })
62
+ if response.to_hash[:create_response][:overall_status] != 'OK'
63
+ raise Exactly::UpsertSubscriberFailed.new(response)
59
64
  end
65
+ rescue Savon::SOAPFault => ex
66
+ raise Exactly::SoapFaultError, "Error: Could not upsert subscriber #{customer_key}/#{email} to ExactTarget: #{ex.message}"
67
+ end
68
+
69
+ def unsubscribe_subscriber(customer_key, email, lists = [])
70
+ response = client.call(
71
+ :create,
72
+ :soap_action => "Create",
73
+ :message => {
74
+ "Options" => {
75
+ "SaveOptions" => [
76
+ "SaveOption" => {
77
+ "PropertyName" => "*",
78
+ "SaveAction" => "UpdateAdd"
79
+ }
80
+ ]
81
+ },
82
+ "Objects" => {
83
+ "CustomerKey" => customer_key,
84
+ "EmailAddress" => email,
85
+ "Lists" => Array(lists).map{|list_id|
86
+ { "ID" => list_id, "Status" => "Unsubscribed" }
87
+ }
88
+ },
89
+ :attributes! => {"Objects" =>{ "xsi:type" => "tns:Subscriber" }}
90
+ })
60
91
  if response.to_hash[:create_response][:overall_status] != 'OK'
61
92
  raise Exactly::UpsertSubscriberFailed.new(response)
62
93
  end
63
- rescue Savon::SOAP::Fault => ex
94
+ rescue Savon::SOAPFault => ex
64
95
  raise Exactly::SoapFaultError, "Error: Could not upsert subscriber #{customer_key}/#{email} to ExactTarget: #{ex.message}"
65
96
  end
66
97
 
67
98
  def upsert_data_extension(customer_key, properties)
68
- response = client.request "UpdateRequest", :xmlns => "http://exacttarget.com/wsdl/partnerAPI" do
69
- http.headers['SOAPAction'] = 'Update'
70
- soap.body = {
99
+ response = client.call(
100
+ :update,
101
+ :soap_action => "Update",
102
+ :message => {
71
103
  "Options" => {
72
104
  "SaveOptions" => [
73
105
  "SaveOption" => {
@@ -79,42 +111,45 @@ module Exactly
79
111
  "Objects" => {
80
112
  "CustomerKey" => customer_key,
81
113
  "Properties" => {
82
- "Property" => properties.map do
83
- |k, v| { "Name" => k, "Value" => v }
114
+ "Property" => properties.map do |k, v|
115
+ { "Name" => k, "Value" => v }
84
116
  end
85
117
  }
86
118
  },
87
- :attributes! => { "Objects" => { "xsi:type" => "DataExtensionObject" }}
88
- }
89
- end
119
+ :attributes! => { "Objects" => { "xsi:type" => "tns:DataExtensionObject" }}
120
+ })
90
121
  if response.to_hash[:update_response][:overall_status] != 'OK'
91
122
  raise Exactly::UpsertDataExtensionFailed.new(response)
92
123
  end
93
124
  end
94
125
 
95
126
  def delete_from_data_extension(customer_key, properties)
96
- client.request "DeleteRequest", :xmlns => "http://exacttarget.com/wsdl/partnerAPI" do
97
- http.headers['SOAPAction'] = 'Delete'
98
- soap.body = {
127
+ response = client.call(
128
+ :delete,
129
+ :soap_action => "Delete",
130
+ :message => {
99
131
  "DeleteOptions" => {},
100
132
  "Objects" => {
101
133
  "CustomerKey" => customer_key,
102
134
  "Keys" => {
103
- "Key" => properties.map do
104
- |k, v| { "Name" => k, "Value" => v }
135
+ "Key" => properties.map do |k, v|
136
+ { "Name" => k, "Value" => v }
105
137
  end
106
138
  }
107
139
  },
108
- :attributes! => { "Objects" => { "xsi:type" => "DataExtensionObject" }}
109
- }
140
+ :attributes! => { "Objects" => { "xsi:type" => "tns:DataExtensionObject" }}
141
+ })
142
+ if response.to_hash[:delete_response][:overall_status] != 'OK'
143
+ raise Exactly::TriggeredSendFailed.new(response)
110
144
  end
111
145
  end
112
146
 
113
147
  def triggered_send(customer_key, attributes)
114
148
  attributes_without_email = attributes.reject{|k,v| k == :email}
115
- response = client.request "CreateRequest", :xmlns => "http://exacttarget.com/wsdl/partnerAPI" do
116
- http.headers['SOAPAction'] = 'Create'
117
- soap.body = {
149
+ response = client.call(
150
+ :create,
151
+ :soap_action => "Create",
152
+ :message => {
118
153
  "Objects" => {
119
154
  "TriggeredSendDefinition" => {
120
155
  "CustomerKey" => customer_key
@@ -127,9 +162,8 @@ module Exactly
127
162
  end
128
163
  }
129
164
  },
130
- :attributes! => { "Objects" => { "xsi:type" => "TriggeredSend" }}
131
- }
132
- end
165
+ :attributes! => { "Objects" => { "xsi:type" => "tns:TriggeredSend" }}
166
+ })
133
167
  if response.to_hash[:create_response][:overall_status] != 'OK'
134
168
  raise Exactly::TriggeredSendFailed.new(response)
135
169
  end
@@ -1,3 +1,3 @@
1
1
  module Exactly
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exactly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.9
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jacob Atzen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-08 00:00:00.000000000 Z
11
+ date: 2013-12-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: savon
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - '='
17
+ - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 0.9.5
19
+ version: '2.2'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - '='
24
+ - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 0.9.5
26
+ version: '2.2'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -61,26 +56,25 @@ files:
61
56
  - lib/exactly/version.rb
62
57
  homepage: http://github.com/lokalebasen/exactly
63
58
  licenses: []
59
+ metadata: {}
64
60
  post_install_message:
65
61
  rdoc_options: []
66
62
  require_paths:
67
63
  - lib
68
64
  required_ruby_version: !ruby/object:Gem::Requirement
69
- none: false
70
65
  requirements:
71
66
  - - ! '>='
72
67
  - !ruby/object:Gem::Version
73
68
  version: '0'
74
69
  required_rubygems_version: !ruby/object:Gem::Requirement
75
- none: false
76
70
  requirements:
77
71
  - - ! '>='
78
72
  - !ruby/object:Gem::Version
79
73
  version: '0'
80
74
  requirements: []
81
75
  rubyforge_project:
82
- rubygems_version: 1.8.23
76
+ rubygems_version: 2.1.11
83
77
  signing_key:
84
- specification_version: 3
78
+ specification_version: 4
85
79
  summary: Making it easier to interact with ExactTargets SOAP API
86
80
  test_files: []