wepay-rails 0.1.114 → 0.1.115

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.114
1
+ 0.1.115
@@ -1,10 +1,14 @@
1
1
  class Wepay::AuthorizeController < Wepay::ApplicationController
2
2
  def index
3
3
  ref_id = session[unique_wepay_auth_token_key]
4
- wepayable = wepayable_class.all(:conditions => ["#{wepayable_column} = ?", ref_id])[0]
4
+ if WepayRails::Configuration.settings[:orm] == 'mongoid'
5
+ wepayable = wepayable_class.where(wepayable_column => ref_id)[0]
6
+ else
7
+ wepayable = wepayable_class.all(:conditions => ["#{wepayable_column} = ?", ref_id])[0]
8
+ end
5
9
  wepayable.update_attribute(wepayable_column.to_sym, params[:code])
6
10
  redirect_to WepayRails::Configuration.settings[:after_authorize_redirect_uri]
7
11
  rescue => e
8
12
  raise AuthorizationError.new("WepayRails was unable to find the record to save the auth code to. : #{e.message}") unless wepayable.present?
9
13
  end
10
- end
14
+ end
data/config/routes.rb CHANGED
@@ -1,5 +1,4 @@
1
- #WepayRails::Engine.routes.draw do |map|
2
- Rails.application.routes.draw do |map|
1
+ Rails.application.routes.draw do
3
2
  namespace :wepay do
4
3
  resources :ipn
5
4
  resources :authorize
@@ -31,4 +31,4 @@ module WepayRails
31
31
  end
32
32
  end
33
33
  end
34
- end
34
+ end
data/lib/wepay-rails.rb CHANGED
@@ -2,7 +2,6 @@ require 'active_record'
2
2
  require 'helpers/model_helpers'
3
3
  require 'helpers/controller_helpers'
4
4
  module WepayRails
5
-
6
5
  class Configuration
7
6
  @@wepayable_class = nil
8
7
  @@wepayable_column = nil
@@ -78,7 +77,7 @@ module WepayRails
78
77
  :redirect_uri => @wepay_config[:redirect_uri],
79
78
  :code => auth_code
80
79
  }
81
- response = self.class.get("#{@base_uri}/oauth2/token", :query => query)
80
+ response = self.class.post("#{@base_uri}/oauth2/token", :body => query)
82
81
  json = JSON.parse(response.body)
83
82
 
84
83
  if json.has_key?("error")
@@ -121,7 +120,7 @@ module WepayRails
121
120
  # retrieved from the first call.
122
121
  def wepay_user
123
122
  user_api = lambda {|headers|
124
- response = self.class.get("#{@base_uri}/user", {:headers => headers})
123
+ response = self.class.post("#{@base_uri}/user", {:headers => headers})
125
124
  JSON.parse(response.body)
126
125
  }
127
126
 
@@ -177,7 +176,7 @@ module WepayRails
177
176
  :account_id => @wepay_config[:account_id]
178
177
  }.merge(parms)
179
178
 
180
- response = self.class.get("#{@base_uri}/checkout/create", {:headers => wepay_auth_header}.merge!(:query => defaults))
179
+ response = self.class.post("#{@base_uri}/checkout/create", {:headers => wepay_auth_header}.merge!(:body => defaults))
181
180
  JSON.parse(response.body)
182
181
  end
183
182
 
@@ -185,17 +184,45 @@ module WepayRails
185
184
  checkout_id = args.first
186
185
  parms = args.last if args.last.is_a?(Hash)
187
186
 
188
- response = self.class.get("#{@base_uri}/checkout", {:headers => wepay_auth_header}.merge!(:query => {:checkout_id => checkout_id}))
187
+ response = self.class.post("#{@base_uri}/checkout", {:headers => wepay_auth_header}.merge!(:body => {:checkout_id => checkout_id}))
188
+ JSON.parse(response.body)
189
+ end
190
+
191
+ def create_account(params)
192
+ response = self.class.post("#{@base_uri}/account/create", {:headers => wepay_auth_header}.merge!(:body => params))
193
+ JSON.parse(response.body)
194
+ end
195
+
196
+ def get_account(account_id)
197
+ response = self.class.post("#{@base_uri}/account", {:headers => wepay_auth_header}.merge!(:body => { account_id: account_id }))
198
+ JSON.parse(response.body)
199
+ end
200
+
201
+ def find_account(args)
202
+ response = self.class.post("#{@base_uri}/account/find", {:headers => wepay_auth_header}.merge!(:body => args))
189
203
  JSON.parse(response.body)
190
204
  end
191
205
 
206
+ def modify_account(params)
207
+ response = self.class.put("#{@base_uri}/account/modify", {:headers => wepay_auth_header}.merge!(:body => args))
208
+ JSON.parse(response.body)
209
+ end
210
+
211
+ def delete_account(account_id)
212
+ response = self.class.post("#{@base_uri}/account/delete", {:headers => wepay_auth_header}.merge!(:body => { account_id: account_id }))
213
+ JSON.parse(response.body)
214
+ end
215
+
216
+ def get_account_balance(account_id)
217
+ response = self.class.post("#{@base_uri}/account/balance", {:headers => wepay_auth_header}.merge!(:body => { account_id: account_id }))
218
+ JSON.parse(response.body)
219
+ end
192
220
  end
193
221
 
194
222
  include WepayRails::Exceptions
195
223
  include WepayRails::Helpers::ControllerHelpers
196
224
  end
197
225
 
198
-
199
226
  def self.included(base)
200
227
  base.extend WepayRails::Helpers::ModelHelpers
201
228
  end
data/wepay-rails.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{wepay-rails}
8
- s.version = "0.1.114"
7
+ s.name = "wepay-rails"
8
+ s.version = "0.1.115"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Adam Medeiros}]
12
- s.date = %q{2011-09-06}
13
- s.description = %q{Rails gem that interfaces with the WePay API}
14
- s.email = %q{adammede@gmail.com}
11
+ s.authors = ["Adam Medeiros"]
12
+ s.date = "2011-10-14"
13
+ s.description = "Rails gem that interfaces with the WePay API"
14
+ s.email = "adammede@gmail.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
17
  "README",
@@ -38,11 +38,11 @@ Gem::Specification.new do |s|
38
38
  "test/test_wepay-rails.rb",
39
39
  "wepay-rails.gemspec"
40
40
  ]
41
- s.homepage = %q{http://github.com/adamthedeveloper/wepay-rails}
42
- s.licenses = [%q{MIT}]
43
- s.require_paths = [%q{lib}]
44
- s.rubygems_version = %q{1.8.7}
45
- s.summary = %q{Rails gem that interfaces with the WePay API}
41
+ s.homepage = "http://github.com/adamthedeveloper/wepay-rails"
42
+ s.licenses = ["MIT"]
43
+ s.require_paths = ["lib"]
44
+ s.rubygems_version = "1.8.10"
45
+ s.summary = "Rails gem that interfaces with the WePay API"
46
46
 
47
47
  if s.respond_to? :specification_version then
48
48
  s.specification_version = 3
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.114
4
+ version: 0.1.115
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: 2011-09-06 00:00:00.000000000Z
12
+ date: 2011-10-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &14918140 !ruby/object:Gem::Requirement
16
+ requirement: &13232840 !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: *14918140
24
+ version_requirements: *13232840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &14917640 !ruby/object:Gem::Requirement
27
+ requirement: &13231320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *14917640
35
+ version_requirements: *13231320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &14917140 !ruby/object:Gem::Requirement
38
+ requirement: &13226500 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *14917140
46
+ version_requirements: *13226500
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &14916640 !ruby/object:Gem::Requirement
49
+ requirement: &13225100 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *14916640
57
+ version_requirements: *13225100
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &14916120 !ruby/object:Gem::Requirement
60
+ requirement: &13223720 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *14916120
68
+ version_requirements: *13223720
69
69
  description: Rails gem that interfaces with the WePay API
70
70
  email: adammede@gmail.com
71
71
  executables: []
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: 3234030736479998172
112
+ hash: 3713795422808856888
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 1.8.7
121
+ rubygems_version: 1.8.10
122
122
  signing_key:
123
123
  specification_version: 3
124
124
  summary: Rails gem that interfaces with the WePay API