appoxy_rails 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
data/lib/appoxy_rails.rb CHANGED
@@ -1,10 +1,26 @@
1
1
  require 'active_support/core_ext'
2
+ require 'digest/hmac'
3
+ require 'net/http'
4
+ require 'base64'
5
+
2
6
  require_relative 'utils'
3
7
  require_relative 'appoxy_ui'
4
- require_relative 'appoxy_api'
5
8
  require_relative 'appoxy_sessions'
6
9
  require_relative 'ui/time_zoner'
7
10
 
11
+ require_relative "rails/api_controller"
12
+ require_relative "rails/signatures"
13
+
14
+
15
+ # backwards compatible.
16
+ # @deprecated
17
+ module Appoxy
18
+ module Api
19
+ include Appoxy::Rails
20
+ extend Appoxy::Rails
21
+ end
22
+ end
23
+
8
24
 
9
25
  if defined?(Rails)
10
26
  # puts 'Rails=' + Rails.inspect
@@ -1,8 +1,8 @@
1
1
  module Appoxy
2
2
 
3
- module Api
3
+ module Rails
4
4
 
5
- # The api controllers that use this should set:
5
+ # The rails controllers that use this should set:
6
6
  # protect_from_forgery :only => [] # can add methods to here, eg: :create, :update, :destroy
7
7
 
8
8
  # rescue_from SigError, :with => :send_error
@@ -26,7 +26,7 @@ module Appoxy
26
26
  end
27
27
 
28
28
  #operation = "#{controller_name}/#{action_name}"
29
- #operation = request.env["PATH_INFO"].gsub(/\/api\//, "")# here we're getting original request url'
29
+ #operation = request.env["PATH_INFO"].gsub(/\/rails\//, "")# here we're getting original request url'
30
30
 
31
31
  # #getting clean params (without parsed via routes)
32
32
  # params_for_signature = params2||request.query_parameters
@@ -46,7 +46,7 @@ module Appoxy
46
46
  signature = "#{controller_name}/#{action_name}"
47
47
  when "0.2"
48
48
  puts "new version of client"
49
- operation = request.env["PATH_INFO"].gsub(/\/api\//, "")# here we're getting original request url'
49
+ operation = request.env["PATH_INFO"].gsub(/\/rails\//, "")# here we're getting original request url'
50
50
  params_for_signature = params2||request.query_parameters
51
51
  params_for_signature = params_for_signature.delete_if {|key, value| ["access_key", "sigv", "sig", "timestamp"].include? key}
52
52
  signature = operation+Appoxy::Api::Signatures.hash_to_s(params_for_signature)
@@ -1,5 +1,5 @@
1
1
  module Appoxy
2
- module Api
2
+ module Rails
3
3
  module Signatures
4
4
 
5
5
 
data/lib/railtie.rb CHANGED
@@ -1,4 +1,4 @@
1
- # see http://api.rubyonrails.org/classes/Rails/Railtie.html
1
+ # see http://rails.rubyonrails.org/classes/Rails/Railtie.html
2
2
 
3
3
  # Nice write-up of hooking gems into the views/layouts/statics of Rails 3 apps:
4
4
  # http://numbers.brighterplanet.com/2010/07/26/sharing-views-across-rails-3-apps/
@@ -118,9 +118,9 @@ module Appoxy
118
118
 
119
119
  def facebook_oauth_url(options={})
120
120
  # puts 'appconfig==' + Rails.application.config.inspect
121
- raise "Please config your facebook id and api keys." unless Rails.application.config.respond_to?(:facebook_app_id)
121
+ raise "Please config your facebook id and rails keys." unless ::Rails.application.config.respond_to?(:facebook_app_id)
122
122
  raise "Scope must be specified." unless options[:scope]
123
- app_id = Rails.application.config.facebook_app_id
123
+ app_id = ::Rails.application.config.facebook_app_id
124
124
  if app_id
125
125
  @facebook_oauth_url = MiniFB.oauth_url(app_id,
126
126
  "#{base_url}/sessions/create_facebook", # redirect url
@@ -284,8 +284,8 @@ module Appoxy
284
284
 
285
285
  def create_facebook
286
286
  return if before_create == false
287
- if facebook_auth(Rails.application.config.facebook_app_id,
288
- Rails.application.config.facebook_secret)
287
+ if facebook_auth(::Rails.application.config.facebook_app_id,
288
+ ::Rails.application.config.facebook_secret)
289
289
  after_create
290
290
 
291
291
  end
@@ -357,9 +357,9 @@ module Appoxy
357
357
  signin = true
358
358
  callback_url = "#{base_url}/sessions/#{(signin ? "create_twitter" : "create_twitter_oauth")}"
359
359
  auth_path = signin ? "authenticate" : "authorize"
360
- consumer = oauth_start(Rails.application.config.twitter_consumer_key, Rails.application.config.twitter_consumer_secret,
360
+ consumer = oauth_start(::Rails.application.config.twitter_consumer_key, Rails.application.config.twitter_consumer_secret,
361
361
  callback_url,
362
- "https://api.twitter.com",
362
+ "https://rails.twitter.com",
363
363
  "/oauth/request_token",
364
364
  "/oauth/#{auth_path}",
365
365
  "/oauth/access_token"
@@ -69,7 +69,7 @@ module Appoxy
69
69
  RELEASE_INFO["deploy_date"] + '</div>'
70
70
  end
71
71
 
72
- if Rails.env == "development"
72
+ if ::Rails.env == "development"
73
73
  ret += '<div style="margin-top: 10px;">' + ERB::Util.html_escape(SimpleRecord.stats.inspect) + '</div>'
74
74
  end
75
75
  ret.html_safe
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appoxy_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
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: rest-client
17
- requirement: &27547968 !ruby/object:Gem::Requirement
17
+ requirement: &23651196 !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: *27547968
25
+ version_requirements: *23651196
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: oauth
28
- requirement: &27547644 !ruby/object:Gem::Requirement
28
+ requirement: &23650908 !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: :runtime
35
35
  prerelease: false
36
- version_requirements: *27547644
36
+ version_requirements: *23650908
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: ruby-openid
39
- requirement: &27547320 !ruby/object:Gem::Requirement
39
+ requirement: &23650620 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *27547320
47
+ version_requirements: *23650620
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: appoxy_api
50
- requirement: &27546996 !ruby/object:Gem::Requirement
50
+ requirement: &23650332 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *27546996
58
+ version_requirements: *23650332
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: mini_fb
61
- requirement: &27546660 !ruby/object:Gem::Requirement
61
+ requirement: &23650044 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *27546660
69
+ version_requirements: *23650044
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: simple_record
72
- requirement: &27546348 !ruby/object:Gem::Requirement
72
+ requirement: &23649756 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *27546348
80
+ version_requirements: *23649756
81
81
  description: Appoxy API Helper gem description...
82
82
  email: travis@appoxy.com
83
83
  executables: []
@@ -85,12 +85,11 @@ extensions: []
85
85
  extra_rdoc_files:
86
86
  - README.markdown
87
87
  files:
88
- - lib/api/api_controller.rb
89
- - lib/api/signatures.rb
90
- - lib/appoxy_api.rb
91
88
  - lib/appoxy_rails.rb
92
89
  - lib/appoxy_sessions.rb
93
90
  - lib/appoxy_ui.rb
91
+ - lib/rails/api_controller.rb
92
+ - lib/rails/signatures.rb
94
93
  - lib/railtie.rb
95
94
  - lib/sessions/application_controller.rb
96
95
  - lib/sessions/oauth_token.rb
data/lib/appoxy_api.rb DELETED
@@ -1,8 +0,0 @@
1
- require 'active_support/core_ext'
2
- require 'digest/hmac'
3
- require 'net/http'
4
- require 'base64'
5
-
6
- require_relative "api/api_controller"
7
- require_relative "api/signatures"
8
-