responsys-api 0.0.4 → 0.0.5
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 +8 -8
- data/README.md +15 -1
- data/lib/responsys/api/campaign.rb +3 -3
- data/lib/responsys/api/object/optional_data.rb +1 -1
- data/lib/responsys/api/object/recipient_data.rb +2 -2
- data/lib/responsys/member.rb +34 -2
- data/responsys-api.gemspec +1 -1
- data/spec/api/object/recipient_data_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTNjZTgyNjk2Zjk4OTgyY2E5MzYwMTgwZDk1MjUzZWE3ZDNiYzI1Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjZmMDFhMThmYmE3N2NkOTM2YjAyNzA0MDEwMDUyZjEwOWE3ZGI1Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGI2ZGQxNDAxM2QyMmY4ZjJhNTIyNmMyZjhkY2MwMWMyNGU0NDgyNTY2MWMz
|
10
|
+
MGVlNWQ4NDg0NWQ0N2M1M2FhODg1MjI3M2JjMjI3MjNjODU3M2E3YjJhODVi
|
11
|
+
MzkzZjQwZDk5OWY5NTI2MzgzMzZhNDQwYjdkNmM2MjIzZGE3N2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTAwYjkyMjEzYTk5ODkzYmU1YmQ5MDVlY2MwMWE3ZmQxNzBiZTkxOThhYWVh
|
14
|
+
NWQ1N2E1MDcxMTdhMTBkMWM1Mzc0YjRhYmQ3MzZiYzEwNzFmMzY1N2VkNDRh
|
15
|
+
NTc5MzljZjY2ZDMyYmFlNTk2ODE0OGVmZGI2ZTgwMGVlOGY1YmI=
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ResponsysApi
|
2
2
|
|
3
|
-
A gem to help you communicate to the Responsys Interact SOAP API.
|
3
|
+
A gem to help you communicate to the Responsys Interact SOAP API. Currently supporting version 6.20.
|
4
4
|
|
5
5
|
## Documentation
|
6
6
|
|
@@ -83,6 +83,20 @@ The API client used by the gem logs in as soon as a the first method is called.
|
|
83
83
|
Responsys::Api::Client.instance.logout
|
84
84
|
```
|
85
85
|
|
86
|
+
###Notes
|
87
|
+
|
88
|
+
####Invalid email format
|
89
|
+
If you try to call the API on a user that has an invalid email format, the API and the GEM will then reply with this message :
|
90
|
+
```
|
91
|
+
{
|
92
|
+
:status=>"ok",
|
93
|
+
:result=>{
|
94
|
+
:recipient_id=>"-1",
|
95
|
+
:error_message=>"Record 0 = BAD EMAIL FORMAT"
|
96
|
+
}
|
97
|
+
}
|
98
|
+
```
|
99
|
+
|
86
100
|
## Contributing
|
87
101
|
|
88
102
|
1. Fork it
|
@@ -4,12 +4,12 @@ module Responsys
|
|
4
4
|
module Api
|
5
5
|
module Campaign
|
6
6
|
include Responsys::Exceptions
|
7
|
-
|
7
|
+
|
8
8
|
def trigger_message(campaign, recipients)
|
9
9
|
raise ParameterException, I18n.t("api.campaign.incorrect_recipients_type") unless recipients.is_a? Array
|
10
10
|
message = {
|
11
11
|
campaign: campaign.to_api,
|
12
|
-
recipientData: recipients.map(&:to_api)
|
12
|
+
recipientData: recipients.map(&:to_api)
|
13
13
|
}
|
14
14
|
api_method(:trigger_campaign_message, message)
|
15
15
|
end
|
@@ -23,4 +23,4 @@ module Responsys
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -4,7 +4,7 @@ module Responsys
|
|
4
4
|
class RecipientData
|
5
5
|
attr_accessor :recipient, :optional_data
|
6
6
|
|
7
|
-
def initialize(recipient, optional_data = Responsys::Api::Object::OptionalData.new)
|
7
|
+
def initialize(recipient, optional_data = [Responsys::Api::Object::OptionalData.new])
|
8
8
|
@recipient = recipient
|
9
9
|
@optional_data = optional_data
|
10
10
|
end
|
@@ -12,7 +12,7 @@ module Responsys
|
|
12
12
|
def to_api
|
13
13
|
{
|
14
14
|
recipient: @recipient.to_api,
|
15
|
-
optionalData: @optional_data.to_api
|
15
|
+
optionalData: @optional_data.map(&:to_api)
|
16
16
|
}
|
17
17
|
end
|
18
18
|
end
|
data/lib/responsys/member.rb
CHANGED
@@ -13,11 +13,23 @@ module Responsys
|
|
13
13
|
@client = Client.instance
|
14
14
|
end
|
15
15
|
|
16
|
-
def add_to_list(list, subscribe = false)
|
16
|
+
def add_to_list(list, subscribe = false, details = {}, update_record = false)
|
17
17
|
data = { EMAIL_ADDRESS_: @email, EMAIL_PERMISSION_STATUS_: subscribe ? "I" : "O" }
|
18
|
+
|
19
|
+
safe_details = {}
|
20
|
+
details.each do |k,v|
|
21
|
+
next if reserved_fields.include? r_key(k)
|
22
|
+
if [Time, Date, DateTime].include?(v.class)
|
23
|
+
safe_details[r_key(k)] = details[k].strftime('%Y-%m-%dT%H:%M:%S%z')
|
24
|
+
else
|
25
|
+
safe_details[r_key(k)] = details[k]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
data = data.merge( safe_details )
|
18
30
|
record = RecordData.new([data])
|
19
31
|
|
20
|
-
@client.merge_list_members_riid(list, record, ListMergeRule.new(insertOnNoMatch: true, updateOnMatch:
|
32
|
+
@client.merge_list_members_riid(list, record, ListMergeRule.new(insertOnNoMatch: true, updateOnMatch: ( update_record ? 'REPLACE_ALL' : 'NO_UPDATE' )))
|
21
33
|
end
|
22
34
|
|
23
35
|
def retrieve_profile_extension(profile_extension, fields)
|
@@ -69,6 +81,26 @@ module Responsys
|
|
69
81
|
|
70
82
|
private
|
71
83
|
|
84
|
+
def r_key(k)
|
85
|
+
k.to_s.upcase.to_sym
|
86
|
+
end
|
87
|
+
|
88
|
+
def reserved_fields
|
89
|
+
# There are also the MOBILE and POSTAL fields. We should allow those to be set via this method
|
90
|
+
[
|
91
|
+
:RIID_,
|
92
|
+
:CREATED_SOURCE_IP_,
|
93
|
+
:CUSTOMER_ID_,
|
94
|
+
:EMAIL_ADDRESS_,
|
95
|
+
:EMAIL_DOMAIN_,
|
96
|
+
:EMAIL_ISP_,
|
97
|
+
:EMAIL_FORMAT_,
|
98
|
+
:EMAIL_PERMISSION_STATUS_,
|
99
|
+
:EMAIL_DELIVERABILITY_STATUS_,
|
100
|
+
:EMAIL_PERMISSION_REASON_,
|
101
|
+
]
|
102
|
+
end
|
103
|
+
|
72
104
|
def lookup_profile_via_key(profile_extension, key, value)
|
73
105
|
@client.retrieve_profile_extension_records(profile_extension, QueryColumn.new(key), %w(RIID_), [value])
|
74
106
|
end
|
data/responsys-api.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "responsys-api"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.5"
|
8
8
|
spec.authors = ["Dan DeMeyere", "Florian Lorrain", "Morgan Griggs", "Mike Rocco"]
|
9
9
|
spec.email = ["dan@thredup.com", "florian.lorrain@thredup.com", "morgan@thredup.com", "michael.rocco@thredup.com"]
|
10
10
|
spec.description = "A gem to integrate with the Responsys SOAP API"
|
@@ -16,7 +16,7 @@ describe Responsys::Api::Object::RecipientData do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should have an optional_data attribute of type Array" do
|
19
|
-
expect(@recipient_data.optional_data).to
|
19
|
+
expect(@recipient_data.optional_data).to include(Responsys::Api::Object::OptionalData)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -37,7 +37,7 @@ describe Responsys::Api::Object::RecipientData do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should have an optionalData attribute of type Array" do
|
40
|
-
expect(@recipient_data.to_api[:optionalData]).to be_a(
|
40
|
+
expect(@recipient_data.to_api[:optionalData]).to be_a(Array)
|
41
41
|
end
|
42
42
|
end
|
43
|
-
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: responsys-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan DeMeyere
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-09-
|
14
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rubyntlm
|