responsys 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +13 -1
  2. data/lib/responsys.rb +6 -9
  3. data/responsys.gemspec +2 -2
  4. metadata +3 -3
data/README.md CHANGED
@@ -1,2 +1,14 @@
1
1
  Responsys
2
- =========
2
+ =========
3
+
4
+ # Sending an email
5
+
6
+ client = Responsys.new('username', 'password')
7
+
8
+ recipients = []
9
+ recipient_one = {email: 'customer@github.com'}
10
+ recipient_two = {id: '1154'}
11
+ recipients << recipient_one
12
+ recipients << recipient_two
13
+
14
+ client.send_email('campaign_name', recipients)
data/lib/responsys.rb CHANGED
@@ -2,7 +2,7 @@ require 'metal/defaultDriver.rb'
2
2
  require 'metal/defaultMappingRegistry.rb'
3
3
 
4
4
  class Responsys
5
- TIMEOUT = 20
5
+ TIMEOUT = 10
6
6
  MAX_MEMBERS = 200
7
7
 
8
8
  class ResponsysTimeoutError < StandardError
@@ -57,10 +57,10 @@ class Responsys
57
57
  # Each element in the list is a hash:
58
58
  # {
59
59
  # id: athlete_id,
60
- # email: email address
60
+ # email: email address,
61
+ # options: {}
61
62
  # }
62
- #
63
- def send_email(campaign_name, recipients, recipient_options = nil)
63
+ def send_email(campaign_name, recipients)
64
64
  trigger_campaign_message = TriggerCampaignMessage.new
65
65
  interact_object = InteractObject.new
66
66
  interact_object.folderName = 'ignored'
@@ -68,11 +68,8 @@ class Responsys
68
68
  trigger_campaign_message.campaign = interact_object
69
69
  trigger_campaign_message.recipientData = []
70
70
 
71
- recipients.each_with_index do |recipient_info, i|
72
- #options = recipient_options[i]
73
-
74
- # Responsys requires something in the optional data for SOAP bindings to work
75
- options = {foo: :bar}
71
+ recipients.each do |recipient_info|
72
+ options = recipient_info.has_key?(:options) ? recipient_info[:options] : {foo: 'bar'}
76
73
 
77
74
  recipient = Recipient.new
78
75
  recipient.emailAddress = recipient_info[:email] if recipient_info[:email]
data/responsys.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'responsys'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = 'Responsys Interact API client.'
6
6
  s.description = 'A client for interacting with the Responsys API.'
7
7
  s.author = 'Leo Romanovsky'
8
8
  s.email = 'leoromanovsky@gmail.com'
9
- s.homepage = 'http://github.com/leoromanovsky/responsys_client'
9
+ s.homepage = 'http://github.com/leoromanovsky/responsys'
10
10
 
11
11
  s.files = `git ls-files`.split("\n")
12
12
  s.test_files = `git ls-files -- test/*`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: responsys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-08 00:00:00.000000000 Z
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mumboe-soap4r
@@ -42,7 +42,7 @@ files:
42
42
  - lib/responsys.rb
43
43
  - responsys.gemspec
44
44
  - test/test_responsys.rb
45
- homepage: http://github.com/leoromanovsky/responsys_client
45
+ homepage: http://github.com/leoromanovsky/responsys
46
46
  licenses: []
47
47
  post_install_message:
48
48
  rdoc_options: []