createsend 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,5 +3,11 @@ rvm:
3
3
  - 2.0.0
4
4
  - 1.9.3
5
5
  - 1.9.2
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - rbx-18mode
9
+ - rbx-19mode
10
+ - ruby-head
11
+ - jruby-head
6
12
  - 1.8.7
7
13
  - ree
@@ -3,6 +3,6 @@
3
3
  1. [Fork the repository](https://help.github.com/articles/fork-a-repo).
4
4
  2. [Create a topic branch](http://learn.github.com/p/branching.html).
5
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`.
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`, `jruby-18mode`, `jruby-19mode`, `rbx-18mode`, `rbx-19mode`, `ruby-head`, `jruby-head`, `1.8.7`, and `ree`.
7
7
  5. It should go without saying, but do not increment the version number in your commits.
8
8
  6. [Submit a pull request](https://help.github.com/articles/using-pull-requests).
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- createsend (3.2.0)
4
+ createsend (3.3.0)
5
5
  hashie (>= 1.2, < 3)
6
6
  httparty (~> 0.10)
7
7
  json
@@ -22,8 +22,8 @@ GEM
22
22
  simplecov (>= 0.7)
23
23
  thor
24
24
  fakeweb (1.3.0)
25
- hashie (2.0.3)
26
- httparty (0.10.2)
25
+ hashie (2.0.4)
26
+ httparty (0.11.0)
27
27
  multi_json (~> 1.0)
28
28
  multi_xml (>= 0.5.2)
29
29
  i18n (0.6.1)
data/HISTORY.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # createsend-ruby history
2
2
 
3
+ ## v3.3.0 - 16 May, 2013
4
+
5
+ * Added Ruby version and platform details to default user agent string.
6
+ * Added support for setting a custom user agent string.
7
+
8
+ You can set a custom user agent string to be used for API calls by doing the following:
9
+
10
+ ```ruby
11
+ CreateSend::CreateSend.user_agent "custom user agent"
12
+ ```
13
+
3
14
  ## v3.2.0 - 15 Apr, 2013
4
15
 
5
16
  * 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.
data/README.md CHANGED
@@ -210,3 +210,7 @@ Full documentation is hosted by [RubyDoc.info](http://rubydoc.info/gems/createse
210
210
  ## Contributing
211
211
 
212
212
  Please check the [guidelines for contributing](https://github.com/campaignmonitor/createsend-ruby/blob/master/CONTRIBUTING.md) to this repository.
213
+
214
+ ## Releasing
215
+
216
+ Please check the [instructions for releasing](https://github.com/campaignmonitor/createsend-ruby/blob/master/RELEASE.md) the `createsend` gem.
@@ -0,0 +1,57 @@
1
+ # Releasing createsend-ruby
2
+
3
+ ## Requirements
4
+
5
+ - You must have a [RubyGems.org](https://rubygems.org/) account and must be an owner of the [createsend](https://rubygems.org/gems/createsend) gem.
6
+
7
+ Owners can be added to the `createsend` gem like this:
8
+
9
+ ```
10
+ gem owner createsend -a newowner@example.com
11
+ ```
12
+
13
+ ## Prepare the release
14
+
15
+ - Increment the `VERSION` constant in the `lib/createsend/version.rb` file, ensuring that you use [Semantic Versioning](http://semver.org/).
16
+ - Add an entry to `HISTORY.md` which clearly explains the new release.
17
+ - Ensure that the `Gemfile.lock` file is updated correctly by running:
18
+
19
+ ```
20
+ bundle install
21
+ ```
22
+
23
+ - Commit your changes:
24
+
25
+ ```
26
+ git commit -am "Version X.Y.Z"
27
+ ```
28
+
29
+ - Tag the new version:
30
+
31
+ ```
32
+ git tag -a vX.Y.Z -m "Version X.Y.Z"
33
+ ```
34
+
35
+ - Push your changes to GitHub, including the tag you just created:
36
+
37
+ ```
38
+ git push origin master --tags
39
+ ```
40
+
41
+ - Ensure that all [tests](https://travis-ci.org/campaignmonitor/createsend-ruby) pass, and that [coverage](https://coveralls.io/r/campaignmonitor/createsend-ruby) is maintained or improved.
42
+
43
+ ## Build the gem
44
+
45
+ ```
46
+ rake build
47
+ ```
48
+
49
+ This builds the gem locally to a file named something like `createsend-X.Y.Z.gem`. You're now ready to release the gem.
50
+
51
+ ## Release the gem
52
+
53
+ ```
54
+ rake release
55
+ ```
56
+
57
+ This publishes the gem to [RubyGems.org](https://rubygems.org/gems/createsend). You should see the newly published version of the gem there. All done!
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.email = ["jdennes@gmail.com"]
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
21
21
  s.files = `git ls-files`.split("\n")
22
- s.homepage = "http://campaignmonitor.github.com/createsend-ruby/"
22
+ s.homepage = "http://campaignmonitor.github.io/createsend-ruby/"
23
23
  s.require_paths = ["lib"]
24
24
  s.summary = %q{A library which implements the complete functionality of the Campaign Monitor API.}
25
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -6,6 +6,8 @@ require 'json'
6
6
 
7
7
  module CreateSend
8
8
 
9
+ USER_AGENT_STRING = "createsend-ruby-#{VERSION}-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}-#{RUBY_PLATFORM}"
10
+
9
11
  # Represents a CreateSend API error. Contains specific data about the error.
10
12
  class CreateSendError < StandardError
11
13
  attr_reader :data
@@ -44,6 +46,16 @@ module CreateSend
44
46
  include HTTParty
45
47
  attr_reader :auth_details
46
48
 
49
+ # Set a custom user agent string to be used when instances of
50
+ # CreateSend::CreateSend make API calls.
51
+ #
52
+ # user_agent - The user agent string to use in the User-Agent header when
53
+ # instances of this class make API calls. If set to nil, the
54
+ # default value of CreateSend::USER_AGENT_STRING will be used.
55
+ def self.user_agent(user_agent)
56
+ headers({'User-Agent' => user_agent || USER_AGENT_STRING})
57
+ end
58
+
47
59
  # Get the authorization URL for your application, given the application's
48
60
  # client_id, redirect_uri, scope, and optional state data.
49
61
  def self.authorize_url(client_id, redirect_uri, scope, state=nil)
@@ -98,7 +110,7 @@ module CreateSend
98
110
  @@oauth_base_uri = "https://api.createsend.com/oauth"
99
111
  @@oauth_token_uri = "#{@@oauth_base_uri}/token"
100
112
  headers({
101
- 'User-Agent' => "createsend-ruby-#{VERSION}",
113
+ 'User-Agent' => USER_AGENT_STRING,
102
114
  'Content-Type' => 'application/json; charset=utf-8',
103
115
  'Accept-Encoding' => 'gzip, deflate' })
104
116
  base_uri @@base_uri
@@ -1,3 +1,3 @@
1
1
  module CreateSend
2
- VERSION = "3.2.0" unless defined?(CreateSend::VERSION)
2
+ VERSION = "3.3.0" unless defined?(CreateSend::VERSION)
3
3
  end
@@ -197,14 +197,23 @@ class CreateSendTest < Test::Unit::TestCase
197
197
  @cs = CreateSend::CreateSend.new @auth
198
198
  end
199
199
 
200
- should "include the CreateSend module VERSION constant as part of the user agent when making a call" do
201
- # This test is done to ensure that the version from HTTParty isn't included instead
202
- assert CreateSend::CreateSend.headers["User-Agent"] == "createsend-ruby-#{CreateSend::VERSION}"
200
+ should "include the correct user agent string when making a call" do
201
+ CreateSend::CreateSend.headers["User-Agent"].should ==
202
+ "createsend-ruby-#{CreateSend::VERSION}-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}-#{RUBY_PLATFORM}"
203
203
  stub_get(@auth, "clients.json", "clients.json")
204
204
  clients = @cs.clients
205
205
  clients.size.should == 2
206
206
  end
207
207
 
208
+ should "allow a custom user agent string to be set when making a call" do
209
+ CreateSend::CreateSend.user_agent "custom user agent"
210
+ CreateSend::CreateSend.headers["User-Agent"].should == "custom user agent"
211
+ stub_get(@auth, "clients.json", "clients.json")
212
+ clients = @cs.clients
213
+ clients.size.should == 2
214
+ CreateSend::CreateSend.user_agent nil
215
+ end
216
+
208
217
  should "get all clients" do
209
218
  stub_get(@auth, "clients.json", "clients.json")
210
219
  clients = @cs.clients
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.2.0
4
+ version: 3.3.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-15 00:00:00.000000000 Z
12
+ date: 2013-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -177,6 +177,7 @@ files:
177
177
  - HISTORY.md
178
178
  - LICENSE
179
179
  - README.md
180
+ - RELEASE.md
180
181
  - Rakefile
181
182
  - createsend.gemspec
182
183
  - lib/createsend.rb
@@ -269,7 +270,7 @@ files:
269
270
  - test/segment_test.rb
270
271
  - test/subscriber_test.rb
271
272
  - test/template_test.rb
272
- homepage: http://campaignmonitor.github.com/createsend-ruby/
273
+ homepage: http://campaignmonitor.github.io/createsend-ruby/
273
274
  licenses: []
274
275
  post_install_message:
275
276
  rdoc_options: []
@@ -374,3 +375,4 @@ test_files:
374
375
  - test/segment_test.rb
375
376
  - test/subscriber_test.rb
376
377
  - test/template_test.rb
378
+ has_rdoc: