createsend 3.1.0 → 3.1.1

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- createsend (3.1.0)
4
+ createsend (3.1.1)
5
5
  hashie (>= 1.2, < 3)
6
6
  httparty (~> 0.10)
7
7
  json
data/HISTORY.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # createsend-ruby history
2
2
 
3
- ## v3.1.0 - 28 Mar, 2013 (8a91dda)
3
+ ## v3.1.1 - 10 Apr, 2013
4
+
5
+ * Fixed a bug occurring sometimes when refreshing OAuth access tokens, because of a URL encoding issue.
6
+
7
+ ## v3.1.0 - 28 Mar, 2013
4
8
 
5
9
  * Added `CreateSend::CreateSend.refresh_access_token` to allow easier refreshing of access tokens when using class methods.
6
10
 
@@ -21,7 +25,7 @@
21
25
 
22
26
  * Added `CreateSend::InvalidOAuthToken` and `CreateSend::RevokedOAuthToken` exceptions to make handling of OAuth exceptions in user code easier.
23
27
 
24
- ## v3.0.0 - 25 Mar, 2013 (129ad0e)
28
+ ## v3.0.0 - 25 Mar, 2013
25
29
 
26
30
  * Added support for authenticating using OAuth. See the [README](README.md#authenticating) for full usage instructions.
27
31
  * Refactored authentication so that it is _always_ done at the instance level. This introduces some breaking changes, which are clearly explained below.
@@ -75,11 +79,11 @@
75
79
  sub = CreateSend::Subscriber.add auth, "list id", "dave@example.com", "Dave", [], true
76
80
  ```
77
81
 
78
- ## v2.5.1 - 4 Feb, 2013 (f0a35ae)
82
+ ## v2.5.1 - 4 Feb, 2013
79
83
 
80
84
  * Updated dependencies in gemspec. Removed cane as a development dependency.
81
85
 
82
- ## v2.5.0 - 11 Dec, 2012 (3054885)
86
+ ## v2.5.0 - 11 Dec, 2012
83
87
 
84
88
  * Added support for including from name, from email, and reply to email in drafts, scheduled, and sent campaigns.
85
89
  * Added support for campaign text version urls.
@@ -87,7 +91,7 @@
87
91
  * Added support for getting account billing details as well as client credits.
88
92
  * Made all date fields optional when getting paged results.
89
93
 
90
- ## v2.4.0 - 5 Nov, 2012 (4277d8d9)
94
+ ## v2.4.0 - 5 Nov, 2012
91
95
 
92
96
  * Added CreateSend::Campaign#email_client_usage.
93
97
  * Added support for ReadsEmailWith field on subscriber objects.
@@ -102,24 +106,24 @@ fields.
102
106
  * Added documentation explaining that text_url may now be nil or an empty
103
107
  string when creating a campaign.
104
108
 
105
- ## v2.3.0 - 10 Oct, 2012 (6639c1f6)
109
+ ## v2.3.0 - 10 Oct, 2012
106
110
 
107
111
  * Added support for creating campaigns from templates.
108
112
  * Added support for unsuppressing an email address.
109
113
  * Improved documentation and tests for getting active subscribers. Clearly
110
114
  documented the data structure for multi option multi select fields.
111
115
 
112
- ## v2.2.0 - 17 Sep, 2012 (17409634)
116
+ ## v2.2.0 - 17 Sep, 2012
113
117
 
114
118
  * Added WorldviewURL field to campaign summary response.
115
119
  * Added Latitude, Longitude, City, Region, CountryCode, and CountryName fields
116
120
  to campaign opens and clicks response.
117
121
 
118
- ## v2.1.0 - 30 Aug, 2012 (ee936259)
122
+ ## v2.1.0 - 30 Aug, 2012
119
123
 
120
124
  * Added support for basic / unlimited pricing.
121
125
 
122
- ## v2.0.0 - 22 Aug, 2012 (8a5ab6b4)
126
+ ## v2.0.0 - 22 Aug, 2012
123
127
 
124
128
  * Added support for UnsubscribeSetting field when creating, updating and
125
129
  getting list details.
@@ -130,27 +134,27 @@ specific email address belongs.
130
134
  * Removed deprecated warnings and disallowed calls to be made in a deprecated
131
135
  manner.
132
136
 
133
- ## v1.1.1 - 24 Jul, 2012 (72934e66)
137
+ ## v1.1.1 - 24 Jul, 2012
134
138
 
135
139
  * Added support for specifying whether subscription-based autoresponders
136
140
  should be restarted when adding or updating subscribers.
137
141
 
138
- ## v1.1.0 - 11 Jul, 2012 (93e856b6)
142
+ ## v1.1.0 - 11 Jul, 2012
139
143
 
140
144
  * Added support for newly released team management functionality.
141
145
 
142
- ## v1.0.4 - 4 May, 2012 (9bce25c1)
146
+ ## v1.0.4 - 4 May, 2012
143
147
 
144
148
  * Added Travis CI support.
145
149
  * Added Gemnasium support.
146
150
  * Fixes to usage of Shoulda and Hashie libraries.
147
151
 
148
- ## v1.0.3 - 3 Dec, 2011 (1ed2b56a)
152
+ ## v1.0.3 - 3 Dec, 2011
149
153
 
150
154
  * Fixes to support Ruby 1.9.* (both the library as well as the rake tasks).
151
155
  * Fixed the User-Agent header so that it now uses the correct module VERSION.
152
156
 
153
- ## v1.0.2 - 31 Oct, 2011 (83020409)
157
+ ## v1.0.2 - 31 Oct, 2011
154
158
 
155
159
  * Added support for deleting a subscriber.
156
160
  * Added support for specifying a 'clear' field when updating or importing
@@ -161,10 +165,10 @@ subscribers.
161
165
  * Added support for including more social sharing stats in campaign summary.
162
166
  * Added support for unscheduling a campaign.
163
167
 
164
- ## v1.0.1 - 25 Oct, 2011 (347b2b95)
168
+ ## v1.0.1 - 25 Oct, 2011
165
169
 
166
170
  * Remove CreateSendOptions and remove usage of yaml config file.
167
171
 
168
- ## v1.0.0 - 26 Sep, 2011 (0a078b09)
172
+ ## v1.0.0 - 26 Sep, 2011
169
173
 
170
174
  * Initial release which supports current Campaign Monitor API.
data/README.md CHANGED
@@ -189,7 +189,7 @@ Error Code: 304
189
189
  Error Message: Campaign Subject Required
190
190
  ```
191
191
 
192
- ### Expected input and output
192
+ ## Expected input and output
193
193
  The best way of finding out the expected input and output of a particular method in a particular class is to use the unit tests as a reference.
194
194
 
195
195
  For example, if you wanted to find out how to call the CreateSend::Subscriber.add method, you would look at the file test/subscriber_test.rb
@@ -77,7 +77,7 @@ module CreateSend
77
77
  # Returns a new access token, 'expires in' value, and refresh token.
78
78
  def self.refresh_access_token(refresh_token)
79
79
  options = {
80
- :body => "grant_type=refresh_token&refresh_token=#{refresh_token}" }
80
+ :body => "grant_type=refresh_token&refresh_token=#{CGI.escape(refresh_token)}" }
81
81
  response = HTTParty.post(@@oauth_token_uri, options)
82
82
  if response.has_key? 'error' and response.has_key? 'error_description'
83
83
  err = "Error refreshing access token: "
@@ -1,3 +1,3 @@
1
1
  module CreateSend
2
- VERSION = "3.1.0" unless defined?(CreateSend::VERSION)
2
+ VERSION = "3.1.1" unless defined?(CreateSend::VERSION)
3
3
  end
@@ -73,23 +73,23 @@ class CreateSendTest < Test::Unit::TestCase
73
73
  Exception, 'Error exchanging code for access token: invalid_grant - Specified code was invalid or expired')
74
74
  FakeWeb.last_request.body.should == "grant_type=authorization_code&client_id=8998879&client_secret=iou0q9wud0q9wd0q9wid0q9iwd0q9wid0q9wdqwd&redirect_uri=http%3A%2F%2Fexample.com%2Fauth&code=invalidcode"
75
75
  end
76
-
76
+
77
77
  should "refresh an access token given a refresh token" do
78
- refresh_token = 'tGzv3JOkF0XG5Qx2TlKWIA'
78
+ refresh_token = 'ASP95S4aR+9KsgfHB0dapTYxNA=='
79
79
  options = {
80
80
  :body => fixture_file("refresh_oauth_token.json"),
81
81
  :content_type => "application/json; charset=utf-8" }
82
82
  FakeWeb.register_uri(:post, "https://api.createsend.com/oauth/token", options)
83
83
  new_access_token, new_expires_in, new_refresh_token = CreateSend::CreateSend.refresh_access_token refresh_token
84
84
 
85
- FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{refresh_token}"
85
+ FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{CGI.escape(refresh_token)}"
86
86
  new_access_token.should == "SlAV32hkKG2e12e"
87
87
  new_expires_in.should == 1209600
88
88
  new_refresh_token.should == "tGzv3JOkF0XG5Qx2TlKWIA"
89
89
  end
90
90
 
91
91
  should "raise an error when an attempt to refresh an access token fails" do
92
- refresh_token = 'invalidrefreshtoken'
92
+ refresh_token = 'ASP95S4aR+9KsgfHB0dapTYxNA=='
93
93
  options = {
94
94
  :body => fixture_file("oauth_refresh_token_error.json"),
95
95
  :content_type => "application/json; charset=utf-8" }
@@ -97,7 +97,7 @@ class CreateSendTest < Test::Unit::TestCase
97
97
  lambda { access_token, expires_in, refresh_token = CreateSend::CreateSend.refresh_access_token(
98
98
  refresh_token) }.should raise_error(
99
99
  Exception, 'Error refreshing access token: invalid_grant - Specified refresh_token was invalid or expired')
100
- FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{refresh_token}"
100
+ FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{CGI.escape(refresh_token)}"
101
101
  end
102
102
 
103
103
  should "get a person's api key" do
@@ -117,8 +117,8 @@ class CreateSendTest < Test::Unit::TestCase
117
117
 
118
118
  context "when an api caller is authenticated using oauth" do
119
119
  setup do
120
- @access_token = "h9898wu98u9dqjoijnwld"
121
- @refresh_token = "tGzv3JOkF0XG5Qx2TlKWIA"
120
+ @access_token = "ASP95S4aR+9KsgfHB0dapTYxNA=="
121
+ @refresh_token = "5S4aASP9R+9KsgfHB0dapTYxNA=="
122
122
  @auth = {
123
123
  :access_token => @access_token,
124
124
  :refresh_token => @refresh_token
@@ -133,7 +133,7 @@ class CreateSendTest < Test::Unit::TestCase
133
133
  cs = CreateSend::CreateSend.new @auth
134
134
  new_access_token, new_expires_in, new_refresh_token = cs.refresh_token
135
135
 
136
- FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=tGzv3JOkF0XG5Qx2TlKWIA"
136
+ FakeWeb.last_request.body.should == "grant_type=refresh_token&refresh_token=#{CGI.escape(@auth[:refresh_token])}"
137
137
  new_access_token.should == "SlAV32hkKG2e12e"
138
138
  new_expires_in.should == 1209600
139
139
  new_refresh_token.should == "tGzv3JOkF0XG5Qx2TlKWIA"
@@ -162,7 +162,7 @@ class CreateSendTest < Test::Unit::TestCase
162
162
  end
163
163
 
164
164
  should "raise an error when an attempt to refresh the access token is made but the refresh token is invalid" do
165
- refresh_token = 'invalidrefreshtoken'
165
+ refresh_token = 'ASP95S4aR+9KsgfHB0dapTYxNA=='
166
166
  cs = CreateSend::CreateSend.new :access_token => 'any token', :refresh_token => refresh_token
167
167
  options = {
168
168
  :body => fixture_file("oauth_refresh_token_error.json"),
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.0
4
+ version: 3.1.1
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-03-28 00:00:00.000000000 Z
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -279,9 +279,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
279
279
  - - ! '>='
280
280
  - !ruby/object:Gem::Version
281
281
  version: '0'
282
- segments:
283
- - 0
284
- hash: -935543352703407509
285
282
  required_rubygems_version: !ruby/object:Gem::Requirement
286
283
  none: false
287
284
  requirements: