wepay-rails 0.1.42 → 0.1.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +56 -56
  2. data/VERSION +1 -1
  3. data/wepay-rails.gemspec +1 -1
  4. metadata +12 -12
data/README.rdoc CHANGED
@@ -7,57 +7,57 @@ add a column to one of your models to hold the authentication token. For example
7
7
 
8
8
  Your migration:
9
9
 
10
- add_column :users, :wepay_auth_code, :string
10
+ add_column :users, :wepay_auth_code, :string
11
11
 
12
12
  Your model:
13
13
 
14
- class User < ActiveRecord::Base
15
- wepayable :wepay_auth_code
16
- end
14
+ class User < ActiveRecord::Base
15
+ wepayable :wepay_auth_code
16
+ end
17
17
 
18
18
  Adding wepayable to your model also adds some helpful methods to your model, like save_<your column name>
19
19
 
20
20
  You'll need a controller and action for wepay to call back - add the entry to your routes file:
21
21
 
22
- class Wepay::AuthorizeController < ApplicationController
23
- before_filter :authenticate_account!
22
+ class Wepay::AuthorizeController < ApplicationController
23
+ before_filter :authenticate_account!
24
24
 
25
- def index
26
- current_user.save_wepay_auth_code params[:code]
27
- initialize_wepay_access_token(params[:code])
25
+ def index
26
+ current_user.save_wepay_auth_code params[:code]
27
+ initialize_wepay_access_token(params[:code])
28
28
 
29
- redirect_to purchase_checkout_index_path
30
- end
29
+ redirect_to purchase_checkout_index_path
30
+ end
31
31
 
32
- private
33
- include WepayRails::Payments
34
- end
32
+ private
33
+ include WepayRails::Payments
34
+ end
35
35
 
36
36
  When you include WepayRails::Payments, you get the controller actions you need. For instance, initialize_wepay_access_token(auth_code)
37
37
  which completes the Oauth2 handshake with Wepay and get's the access token for future comunications with Wepay.
38
38
 
39
39
  Finally, your checkout controller (or some controller that will interact with the Wepay API):
40
40
 
41
- class Purchase::CheckoutController < ApplicationController
42
- before_filter :authenticate_account!
43
-
44
- def index
45
- if current_user.has_wepay_auth_code?
46
- if wepay_access_token_exists?
47
- # Send payment off to wepay or get the user or something else
48
- render :json => gateway.wepay_user
49
- return
50
- else
51
- initialize_wepay_access_token(current_user.wepay_auth_code)
41
+ class Purchase::CheckoutController < ApplicationController
42
+ before_filter :authenticate_account!
43
+
44
+ def index
45
+ if current_user.has_wepay_auth_code?
46
+ if wepay_access_token_exists?
47
+ # Send payment off to wepay or get the user or something else
48
+ render :json => gateway.wepay_user
49
+ return
50
+ else
51
+ initialize_wepay_access_token(current_user.wepay_auth_code)
52
+ end
53
+ else
54
+ redirect_to_wepay_for_auth
55
+ end
52
56
  end
53
- else
54
- redirect_to_wepay_for_auth
55
- end
56
- end
57
57
 
58
- private
59
- include WepayRails::Payments
60
- end
58
+ private
59
+ include WepayRails::Payments
60
+ end
61
61
 
62
62
  First, we check to see if we have saved the auth code for the user, if so, we next need to see if we have an Oauth2 access token.
63
63
  If not, we can initialize the access token. If it is there, go ahead and make an api call - the example above gets the
@@ -65,30 +65,30 @@ wepay_user.
65
65
 
66
66
  Configuration is done through config/wepay.yml:
67
67
 
68
- production:
69
- client_id: <your wepay client id>
70
- client_secret: <your wepay client secret code>
71
- redirect_uri: "<your callback url in your rails app>"
72
- scope: ['refund_payments','collect_payments','view_balance','view_user']
73
- #wepay_api_uri: "https://api.wepay.com"
74
- wepay_api_uri: "https://stage.wepay.com"
75
- wepay_api_version: "v2"
76
-
77
- development:
78
- client_id: 12345
79
- client_secret: 12345asdfg
80
- redirect_uri: "http://www.example.com/wepay/authorize"
81
- scope: ['refund_payments','collect_payments','view_balance','view_user']
82
- wepay_api_uri: "https://stage.wepay.com"
83
- wepay_api_version: "v2"
84
-
85
- test:
86
- client_id: 12345
87
- client_secret: 12345asdfg
88
- redirect_uri: "http://www.example.com/wepay/authorize"
89
- scope: ['refund_payments','collect_payments','view_balance','view_user']
90
- wepay_api_uri: "https://stage.wepay.com"
91
- wepay_api_version: "v2"
68
+ production:
69
+ client_id: <your wepay client id>
70
+ client_secret: <your wepay client secret code>
71
+ redirect_uri: "<your callback url in your rails app>"
72
+ scope: ['refund_payments','collect_payments','view_balance','view_user']
73
+ #wepay_api_uri: "https://api.wepay.com"
74
+ wepay_api_uri: "https://stage.wepay.com"
75
+ wepay_api_version: "v2"
76
+
77
+ development:
78
+ client_id: 12345
79
+ client_secret: 12345asdfg
80
+ redirect_uri: "http://www.example.com/wepay/authorize"
81
+ scope: ['refund_payments','collect_payments','view_balance','view_user']
82
+ wepay_api_uri: "https://stage.wepay.com"
83
+ wepay_api_version: "v2"
84
+
85
+ test:
86
+ client_id: 12345
87
+ client_secret: 12345asdfg
88
+ redirect_uri: "http://www.example.com/wepay/authorize"
89
+ scope: ['refund_payments','collect_payments','view_balance','view_user']
90
+ wepay_api_uri: "https://stage.wepay.com"
91
+ wepay_api_version: "v2"
92
92
 
93
93
 
94
94
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.42
1
+ 0.1.43
data/wepay-rails.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wepay-rails}
8
- s.version = "0.1.42"
8
+ s.version = "0.1.43"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Adam Medeiros"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wepay-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.42
4
+ version: 0.1.43
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
17
- requirement: &2151866740 !ruby/object:Gem::Requirement
17
+ requirement: &2151867560 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2151866740
25
+ version_requirements: *2151867560
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: shoulda
28
- requirement: &2151865300 !ruby/object:Gem::Requirement
28
+ requirement: &2151865880 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2151865300
36
+ version_requirements: *2151865880
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &2151864020 !ruby/object:Gem::Requirement
39
+ requirement: &2151864520 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2151864020
47
+ version_requirements: *2151864520
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: jeweler
50
- requirement: &2151861920 !ruby/object:Gem::Requirement
50
+ requirement: &2151862840 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.6.4
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2151861920
58
+ version_requirements: *2151862840
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rcov
61
- requirement: &2151859400 !ruby/object:Gem::Requirement
61
+ requirement: &2151860140 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2151859400
69
+ version_requirements: *2151860140
70
70
  description: Rails gem that interfaces with the WePay API
71
71
  email: adammede@gmail.com
72
72
  executables: []
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: 1019805336201408693
110
+ hash: -4268076542232812393
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  none: false
113
113
  requirements: