createsend 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,8 @@
1
+ # Guidelines for contributing
2
+
3
+ 1. [Fork the repository](https://help.github.com/articles/fork-a-repo).
4
+ 2. [Create a topic branch](http://learn.github.com/p/branching.html).
5
+ 3. Make your changes, including tests for your changes which maintain [coverage](https://coveralls.io/r/campaignmonitor/createsend-ruby).
6
+ 4. Ensure that all tests pass, by running `bundle exec rake`. The [Travis CI build](https://travis-ci.org/campaignmonitor/createsend-ruby) runs on Ruby `2.0.0`, `1.9.3`, `1.9.2`, `1.8.7`, and `ree`.
7
+ 5. It should go without saying, but do not increment the version number in your commits.
8
+ 6. [Submit a pull request](https://help.github.com/articles/using-pull-requests).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- createsend (3.1.1)
4
+ createsend (3.2.0)
5
5
  hashie (>= 1.2, < 3)
6
6
  httparty (~> 0.10)
7
7
  json
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # createsend-ruby history
2
2
 
3
+ ## v3.2.0 - 15 Apr, 2013
4
+
5
+ * Added support for [single sign on](http://www.campaignmonitor.com/api/account/#single_sign_on) which allows initiation of external login sessions to Campaign Monitor.
6
+
3
7
  ## v3.1.1 - 10 Apr, 2013
4
8
 
5
9
  * Fixed a bug occurring sometimes when refreshing OAuth access tokens, because of a URL encoding issue.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # createsend
2
2
  [![Build Status](https://secure.travis-ci.org/campaignmonitor/createsend-ruby.png)][travis] [![Coverage Status](https://coveralls.io/repos/campaignmonitor/createsend-ruby/badge.png?branch=master)][coveralls] [![Dependency Status](https://gemnasium.com/campaignmonitor/createsend-ruby.png)][gemnasium] [![Gem Version](https://badge.fury.io/rb/createsend.png)][gembadge]
3
3
 
4
- A ruby library which implements the complete functionality of the [Campaign Monitor API](http://www.campaignmonitor.com/api/).
4
+ A Ruby library which implements the complete functionality of the [Campaign Monitor API](http://www.campaignmonitor.com/api/).
5
5
 
6
6
  [travis]: http://travis-ci.org/campaignmonitor/createsend-ruby
7
7
  [coveralls]: https://coveralls.io/r/campaignmonitor/createsend-ruby
@@ -208,8 +208,5 @@ end
208
208
  Full documentation is hosted by [RubyDoc.info](http://rubydoc.info/gems/createsend/frames).
209
209
 
210
210
  ## Contributing
211
- 1. Fork the repository
212
- 2. Make your changes, including tests for your changes which maintain [coverage][coveralls].
213
- 3. Ensure that the build passes, by running `bundle exec rake` (CI runs on: `2.0.0`, `1.9.3`, `1.9.2`, `1.8.7`, and `ree`)
214
- 4. It should go without saying, but do not increment the version number in your commits.
215
- 5. Submit a pull request.
211
+
212
+ Please check the [guidelines for contributing](https://github.com/campaignmonitor/createsend-ruby/blob/master/CONTRIBUTING.md) to this repository.
@@ -183,6 +183,33 @@ module CreateSend
183
183
  Hashie::Mash.new(response)
184
184
  end
185
185
 
186
+ # Get a URL which initiates a new external session for the user with the
187
+ # given email.
188
+ # Full details: http://www.campaignmonitor.com/api/account/#single_sign_on
189
+ #
190
+ # email - The email address of the Campaign Monitor user for whom
191
+ # the login session should be created.
192
+ # chrome - Which 'chrome' to display - Must be either "all",
193
+ # "tabs", or "none".
194
+ # url - The URL to display once logged in. e.g. "/subscribers/"
195
+ # integrator_id - The integrator ID. You need to contact Campaign Monitor
196
+ # support to get an integrator ID.
197
+ # client_id - The Client ID of the client which should be active once
198
+ # logged in to the Campaign Monitor account.
199
+ #
200
+ # Returns An object containing a single field SessionUrl which represents
201
+ # the URL to initiate the external Campaign Monitor session.
202
+ def external_session_url(email, chrome, url, integrator_id, client_id)
203
+ options = { :body => {
204
+ :Email => email,
205
+ :Chrome => chrome,
206
+ :Url => url,
207
+ :IntegratorID => integrator_id,
208
+ :ClientID => client_id }.to_json }
209
+ response = put("/externalsession.json", options)
210
+ Hashie::Mash.new(response)
211
+ end
212
+
186
213
  def get(*args)
187
214
  args = add_auth_details_to_options(args)
188
215
  handle_response CreateSend.get(*args)
@@ -1,3 +1,3 @@
1
1
  module CreateSend
2
- VERSION = "3.1.1" unless defined?(CreateSend::VERSION)
2
+ VERSION = "3.2.0" unless defined?(CreateSend::VERSION)
3
3
  end
@@ -261,6 +261,17 @@ class CreateSendTest < Test::Unit::TestCase
261
261
  result.EmailAddress.should == 'admin@blackhole.com'
262
262
  end
263
263
 
264
+ should "get an external session url" do
265
+ email = "exammple@example.com"
266
+ chrome = "None"
267
+ url = "/subscribers"
268
+ integrator_id = "qw989q8wud98qwyd"
269
+ client_id = "9q8uw9d8u9wud"
270
+ stub_put(@auth, "externalsession.json", "external_session.json")
271
+ result = @cs.external_session_url email, chrome, url, integrator_id, client_id
272
+ result.SessionUrl.should == "https://external1.createsend.com/cd/create/ABCDEF12/DEADBEEF?url=FEEDDAD1"
273
+ end
274
+
264
275
  end
265
276
 
266
277
  context "when the CreateSend API responds with an error" do
@@ -0,0 +1,3 @@
1
+ {
2
+ "SessionUrl": "https://external1.createsend.com/cd/create/ABCDEF12/DEADBEEF?url=FEEDDAD1"
3
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: createsend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
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: 2013-04-10 00:00:00.000000000 Z
12
+ date: 2013-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -171,6 +171,7 @@ files:
171
171
  - .coveralls.yml
172
172
  - .gitignore
173
173
  - .travis.yml
174
+ - CONTRIBUTING.md
174
175
  - Gemfile
175
176
  - Gemfile.lock
176
177
  - HISTORY.md
@@ -231,6 +232,7 @@ files:
231
232
  - test/fixtures/drafts.json
232
233
  - test/fixtures/email_client_usage.json
233
234
  - test/fixtures/expired_oauth_token_api_error.json
235
+ - test/fixtures/external_session.json
234
236
  - test/fixtures/import_subscribers.json
235
237
  - test/fixtures/import_subscribers_partial_success.json
236
238
  - test/fixtures/invalid_oauth_token_api_error.json
@@ -335,6 +337,7 @@ test_files:
335
337
  - test/fixtures/drafts.json
336
338
  - test/fixtures/email_client_usage.json
337
339
  - test/fixtures/expired_oauth_token_api_error.json
340
+ - test/fixtures/external_session.json
338
341
  - test/fixtures/import_subscribers.json
339
342
  - test/fixtures/import_subscribers_partial_success.json
340
343
  - test/fixtures/invalid_oauth_token_api_error.json