spreedly 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === 1.3.3
2
+ * Add support for return_url in Spreedly.edit_subscriber_url [jjthrash]
3
+ * Add support for return_url in Spreedly.subscribe_url [jjthrash]
4
+
1
5
  === 1.3.2
2
6
 
3
7
  * Added methods on subscriber: update, allow_free_trial,
@@ -16,12 +16,12 @@ module Spreedly
16
16
  # :first_name => pre-populate the first name field
17
17
  # :last_name => pre-populate the last name field
18
18
  def self.subscribe_url(id, plan, options={})
19
- %w(screen_name email first_name last_name).each do |option|
19
+ %w(screen_name email first_name last_name return_url).each do |option|
20
20
  options[option.to_sym] &&= URI.escape(options[option.to_sym])
21
21
  end
22
22
 
23
23
  screen_name = options.delete(:screen_name)
24
- params = %w(email first_name last_name).select{|e| options[e.to_sym]}.collect{|e| "#{e}=#{options[e.to_sym]}"}.join('&')
24
+ params = %w(email first_name last_name return_url).select{|e| options[e.to_sym]}.collect{|e| "#{e}=#{options[e.to_sym]}"}.join('&')
25
25
 
26
26
  url = "https://spreedly.com/#{site_name}/subscribers/#{id}/subscribe/#{plan}"
27
27
  url << "/#{screen_name}" if screen_name
@@ -33,7 +33,12 @@ module Spreedly
33
33
  # Generates an edit subscriber for the given subscriber token. The
34
34
  # token is returned with the subscriber info (i.e. by
35
35
  # Subscriber.find).
36
- def self.edit_subscriber_url(token)
37
- "https://spreedly.com/#{site_name}/subscriber_accounts/#{token}"
36
+ def self.edit_subscriber_url(token, return_url = nil)
37
+ "https://spreedly.com/#{site_name}/subscriber_accounts/#{token}" +
38
+ if return_url
39
+ "?return_url=#{URI.escape(return_url)}"
40
+ else
41
+ ''
42
+ end
38
43
  end
39
44
  end
@@ -1,3 +1,3 @@
1
1
  module Spreedly
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
@@ -126,11 +126,15 @@ class SpreedlyGemTest < Test::Unit::TestCase
126
126
  Spreedly.subscribe_url('joe', '1', :email => "joe.bob@test.com", :first_name => "Joe", :last_name => "Bob")
127
127
  assert_equal "https://spreedly.com/#{Spreedly.site_name}/subscribers/joe/subscribe/1?first_name=Joe&last_name=Bob",
128
128
  Spreedly.subscribe_url('joe', '1', :first_name => "Joe", :last_name => "Bob")
129
+ assert_equal "https://spreedly.com/#{Spreedly.site_name}/subscribers/joe/subscribe/1?return_url=http://stuffo.example.com",
130
+ Spreedly.subscribe_url('joe', '1', :return_url => 'http://stuffo.example.com')
129
131
  end
130
132
 
131
133
  should "generate an edit subscriber url" do
132
134
  assert_equal "https://spreedly.com/#{Spreedly.site_name}/subscriber_accounts/zetoken",
133
135
  Spreedly.edit_subscriber_url('zetoken')
136
+ assert_equal "https://spreedly.com/#{Spreedly.site_name}/subscriber_accounts/zetoken?return_url=http://stuffo.example.com",
137
+ Spreedly.edit_subscriber_url('zetoken', 'http://stuffo.example.com')
134
138
  end
135
139
 
136
140
  should "comp an inactive subscriber" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreedly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 2
10
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathaniel Talbott
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-04 00:00:00 -04:00
18
+ date: 2010-10-15 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -70,12 +70,12 @@ dependencies:
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- hash: 23
73
+ hash: 19
74
74
  segments:
75
75
  - 2
76
76
  - 6
77
- - 0
78
- version: 2.6.0
77
+ - 2
78
+ version: 2.6.2
79
79
  type: :development
80
80
  version_requirements: *id004
81
81
  description: |-