paypal-subscribe 0.2.0 → 0.3.0
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.
- data/README.md +13 -1
- data/VERSION +1 -1
- data/lib/paypal-subscribe/action_view/form_helper.rb +40 -22
- data/paypal-subscribe.gemspec +2 -2
- metadata +17 -17
data/README.md
CHANGED
@@ -103,9 +103,17 @@ For more informations which options are already included see [here](https://gith
|
|
103
103
|
Open your view and put a helper in it:
|
104
104
|
|
105
105
|
```ruby
|
106
|
-
<%=
|
106
|
+
<%=paypal_subscribe_form :image => "logo.png", :alt => "Button description"%>
|
107
107
|
```
|
108
108
|
|
109
|
+
To use a ordinary button instead of an image use:
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
<%= paypal_subscribe_form :button => true, :value => "Pay with Paypal",
|
113
|
+
:html => {:class=> "btn btn-alert"} %>
|
114
|
+
```
|
115
|
+
|
116
|
+
|
109
117
|
**Note** that image is just a file (name) which should be accessible through the asset pipeline.
|
110
118
|
|
111
119
|
## Callbacks
|
@@ -142,6 +150,10 @@ config.failure_callback = :my_own_failure_callback_route
|
|
142
150
|
config.paypal_notify = :my_own_notify_callback_route
|
143
151
|
```
|
144
152
|
|
153
|
+
## Contributors
|
154
|
+
|
155
|
+
Thanks to Paavo Leinonen <paavo@dealmachine.net>.
|
156
|
+
|
145
157
|
## Contributing to paypal-subscribe
|
146
158
|
|
147
159
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -29,41 +29,59 @@ module ActionView
|
|
29
29
|
# </form>
|
30
30
|
#
|
31
31
|
# * args - a list of arguments that includes an options hash:
|
32
|
-
# * image -
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
32
|
+
# * :image - The name of the image which is used within submit button.
|
33
|
+
# Note that the image should be just a name which is accesible
|
34
|
+
# through the asset pipeline. This is only useable if :button is false
|
35
|
+
# or not used.
|
36
|
+
# * :alt - The alt tag content for the button (if image is used)
|
37
|
+
# * :button - Indicator if a submit button should be used instead of an image
|
38
|
+
# * :html - Any html options. See ActionView::Helpers::FormTagHelper#submit_tag
|
39
|
+
# for details.
|
40
|
+
# * :id - The submit tag id. Defaults to "paypal_submit"
|
36
41
|
# Other configurations should be made in Rails.root/config/initializers
|
37
42
|
#
|
38
43
|
# Returns a HTML form.
|
39
44
|
def paypal_subscribe_button(*args)
|
40
45
|
options = args.extract_options!
|
46
|
+
id = options.fetch(:id, "paypal_submit")
|
41
47
|
paypal_uri = PaypalSubscribe.paypal_url
|
42
|
-
paypal_form = form_tag(paypal_uri, :method =>
|
43
|
-
|
44
|
-
paypal_form += hidden_field_tag("cmd", "_xclick-subscriptions")
|
48
|
+
paypal_form = form_tag(paypal_uri, :method => :post) do
|
49
|
+
fields = hidden_field_tag("cmd", "_xclick-subscriptions")
|
45
50
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
+
config = PaypalSubscribe.paypal_config
|
52
|
+
callbacks = []
|
53
|
+
callbacks << {:return => config.delete(:return)}
|
54
|
+
callbacks << {:cancel_return => config.delete(:cancel_return)}
|
55
|
+
callbacks << {:notify_url => config.delete(:notify_url)}
|
51
56
|
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
config.each_pair do |key,value|
|
58
|
+
fields << hidden_field_tag("#{key}", (options[key] ? options[key] : value))
|
59
|
+
end
|
55
60
|
|
56
|
-
|
57
|
-
|
58
|
-
|
61
|
+
callbacks.each do |callback_config|
|
62
|
+
callback_config.each_pair do |key,value|
|
63
|
+
fields << hidden_field_tag(key,self.send("#{value}_url"))
|
64
|
+
end
|
59
65
|
end
|
60
|
-
end
|
61
66
|
|
62
|
-
|
67
|
+
image_source = asset_path(options[:image])
|
63
68
|
|
64
|
-
|
69
|
+
if options[:button]
|
70
|
+
html_options = options.fetch(:html, {})
|
71
|
+
html_options[:id] = id
|
72
|
+
fields << submit_tag(options[:value],html_options)
|
73
|
+
else
|
74
|
+
fields << image_submit_tag(image_source,
|
75
|
+
{ :alt => options[:alt],
|
76
|
+
:name => "submit",
|
77
|
+
:id => id
|
78
|
+
})
|
79
|
+
|
80
|
+
end
|
81
|
+
fields
|
82
|
+
end
|
65
83
|
|
66
|
-
paypal_form
|
84
|
+
paypal_form.html_safe
|
67
85
|
end
|
68
86
|
alias_method :paypal_subscribe_form,:paypal_subscribe_button
|
69
87
|
end
|
data/paypal-subscribe.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "paypal-subscribe"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Schmidt"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-05-22"
|
13
13
|
s.description = "A rails helper to display a PayPal subscribe button."
|
14
14
|
s.email = "dsci@code79.net"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-subscribe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70337174823380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70337174823380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70337174822680 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.8.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70337174822680
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &70337174822140 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.12'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70337174822140
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70337174821600 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70337174821600
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70337174820980 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.8.4
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70337174820980
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &70337174820500 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70337174820500
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: fuubar
|
82
|
-
requirement: &
|
82
|
+
requirement: &70337174820020 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70337174820020
|
91
91
|
description: A rails helper to display a PayPal subscribe button.
|
92
92
|
email: dsci@code79.net
|
93
93
|
executables: []
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 4504830316284751824
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|