metova 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/app/controllers/metova/api/sessions_controller.rb +51 -0
- data/app/controllers/metova/omniauth_callbacks_controller.rb +68 -0
- data/app/controllers/metova/registrations_controller.rb +25 -0
- data/app/controllers/metova/s3_controller.rb +13 -0
- data/app/models/metova/identity.rb +11 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20150620175834_create_metova_identities.rb +10 -0
- data/lib/metova/api.rb +2 -0
- data/lib/metova/devise/controller.rb +6 -3
- data/lib/metova/devise/models/token_authenticatable.rb +1 -1
- data/lib/metova/devise/strategies/token_authenticatable.rb +1 -3
- data/lib/metova/engine.rb +9 -0
- data/lib/metova/error.rb +5 -5
- data/lib/metova/mandrill/railtie.rb +0 -1
- data/lib/metova/oauth/facebook_provider.rb +25 -0
- data/lib/metova/oauth/flux_provider.rb +25 -0
- data/lib/metova/oauth/generic_provider.rb +33 -0
- data/lib/metova/oauth/google_provider.rb +10 -0
- data/lib/metova/oauth/twitter_provider.rb +36 -0
- data/lib/metova/oauth.rb +12 -0
- data/lib/metova/responder.rb +8 -4
- data/lib/metova/responders/http_cache_responder.rb +31 -0
- data/lib/metova/responders/ids_filter_responder.rb +1 -3
- data/lib/metova/responders/nested_association_responder.rb +14 -0
- data/lib/metova/responders/pagination_responder.rb +1 -3
- data/lib/metova/responders/search_responder.rb +1 -3
- data/lib/metova/responders/sort_responder.rb +1 -3
- data/lib/metova/version.rb +1 -1
- data/lib/metova.rb +2 -0
- metadata +123 -27
- data/lib/metova/carrierwave/railtie.rb +0 -38
- data/lib/metova/carrierwave.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmVhYzhmMjZhNjQyNDFiMmRjZDFmODQ5ZjgyMjQ4MjRlNzBhZGQyYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NTIwZjZmNDUwODMyYjRlMjViOGUzNzYyYjdjMTEzYmNhM2QzYWRjNw==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjFhMzk5NTI2MDA2MTFjYzBmZDM2OTA1YmRhZmQ5YjlkMmNiODk1ODM2ODM5
|
10
|
+
NDNlZGI0OGYxZTBlNGNjZWZjMTliMjYzNzIyY2RjY2M5YmU0YWJkM2MxYTUz
|
11
|
+
ZmM5Y2VmN2I0MjMxOTE4YmUxYTYxYjVlMjQwZDkyOTExMTYwZTU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZTRjODc0YjEwMDMwMGMyMjU0YTBhMjQ1ZWZkYWU1MGYzYWUwZTMzNTliZTc1
|
14
|
+
ODI0ZmIzNmEyYmQ2Y2Y0MTg5MGZiMmJkYmMzNzdkMWFkYjQ5OTU1NjVmNTYy
|
15
|
+
ZGNmNzU2MDNlOWQyYjI2NjQ4NTdlMDA1NjM0ZWJmNGJjNWVjNTc=
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class Metova::API::SessionsController < ::Devise::SessionsController
|
2
|
+
respond_to :json
|
3
|
+
|
4
|
+
def create
|
5
|
+
if params[:provider]
|
6
|
+
sign_in_with_oauth
|
7
|
+
else
|
8
|
+
super
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
def sign_in_with_oauth
|
14
|
+
provider = params[:provider]
|
15
|
+
auth = Metova::Oauth::GenericProvider.authenticate provider, params[:access_token], params[:token_secret]
|
16
|
+
@identity = Metova::Identity.find_or_initialize_with_omniauth(auth)
|
17
|
+
|
18
|
+
if signed_in?(:api_user)
|
19
|
+
attach_identity_to_user @identity, current_api_user
|
20
|
+
else
|
21
|
+
sign_in_or_sign_up_with_identity @identity, auth
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def sign_in_or_sign_up_with_identity(identity, auth)
|
26
|
+
if user = identity.user
|
27
|
+
sign_in_user user
|
28
|
+
else
|
29
|
+
sign_up_user auth, identity
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def attach_identity_to_user(identity, user)
|
34
|
+
identity.update(user: user) if identity.user != user
|
35
|
+
respond_with identity, location: nil
|
36
|
+
end
|
37
|
+
|
38
|
+
def sign_in_user(user)
|
39
|
+
user.reset_authentication_token! if user.token_expired?
|
40
|
+
respond_with user, location: nil
|
41
|
+
end
|
42
|
+
|
43
|
+
def sign_up_user(auth, identity)
|
44
|
+
user = User.new Hash[email: auth.info.email, password: SecureRandom.hex].merge(sign_in_params)
|
45
|
+
if user.save and identity.update(user: user)
|
46
|
+
sign_in_user user
|
47
|
+
else
|
48
|
+
respond_with user
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
class Metova::OmniauthCallbacksController < ::Devise::OmniauthCallbacksController
|
2
|
+
|
3
|
+
PROVIDERS = [
|
4
|
+
:flux,
|
5
|
+
:twitter,
|
6
|
+
:facebook,
|
7
|
+
:google_oauth2,
|
8
|
+
:instagram
|
9
|
+
]
|
10
|
+
|
11
|
+
def all
|
12
|
+
@identity = Metova::Identity.find_or_initialize_with_omniauth auth
|
13
|
+
if signed_in?
|
14
|
+
attach_identity_to_user @identity, current_user
|
15
|
+
else
|
16
|
+
sign_in_or_sign_up_with_identity @identity
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# redirect each provider to the "all" method
|
21
|
+
PROVIDERS.each do |provider|
|
22
|
+
define_method(provider) { all }
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def auth
|
27
|
+
@_auth ||= request.env['omniauth.auth']
|
28
|
+
end
|
29
|
+
|
30
|
+
def attach_identity_to_user(identity, user)
|
31
|
+
if identity.user == user
|
32
|
+
redirect_with_notification 'You are already linked with this account.'
|
33
|
+
else
|
34
|
+
identity.update user: user
|
35
|
+
redirect_with_notification 'Successfully linked your account.'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def sign_in_or_sign_up_with_identity(identity)
|
40
|
+
if identity.user.present?
|
41
|
+
sign_in_and_redirect :user, identity.user
|
42
|
+
else
|
43
|
+
sign_up_user auth, identity
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def sign_up_user(auth, identity)
|
48
|
+
user = User.new email: auth.info.email, password: SecureRandom.hex
|
49
|
+
if user.save and identity.update(user: user)
|
50
|
+
sign_in_and_redirect :user, identity.user
|
51
|
+
else
|
52
|
+
save_oauth_session_data_and_prompt_user_to_complete_registration(auth)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def save_oauth_session_data_and_prompt_user_to_complete_registration(auth)
|
57
|
+
session[:omniauth] = auth.except 'extra'
|
58
|
+
redirect_to after_invalid_user_sign_up_path
|
59
|
+
end
|
60
|
+
|
61
|
+
def redirect_with_notification(notification, path: main_app.root_path)
|
62
|
+
redirect_to path, notice: notification
|
63
|
+
end
|
64
|
+
|
65
|
+
def after_invalid_user_sign_up_path
|
66
|
+
main_app.new_user_registration_path
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class Metova::RegistrationsController < ::Devise::RegistrationsController
|
2
|
+
|
3
|
+
def create
|
4
|
+
super
|
5
|
+
session[:omniauth] = nil if resource.persisted?
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
def build_resource(*args)
|
10
|
+
super
|
11
|
+
if omniauth = session[:omniauth]
|
12
|
+
set_omniauth_attributes_on_user omniauth
|
13
|
+
resource.identities.build provider: omniauth['provider'], uid: omniauth['uid']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
helper_method \
|
18
|
+
def has_omniauth_session_data?
|
19
|
+
session[:omniauth].present?
|
20
|
+
end
|
21
|
+
|
22
|
+
def set_omniauth_attributes_on_user(omniauth)
|
23
|
+
resource.email ||= omniauth['info']['email']
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Metova::S3Controller < Metova::ApplicationController
|
2
|
+
respond_to :json
|
3
|
+
|
4
|
+
def presigned_url
|
5
|
+
if defined? Refile
|
6
|
+
signature = Refile.store.presign
|
7
|
+
respond_with signature
|
8
|
+
else
|
9
|
+
respond_with Metova::GenericError.new('Server maintainer must install Refile before using S3 direct uploads!')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Metova
|
2
|
+
class Identity < ActiveRecord::Base
|
3
|
+
belongs_to :user, required: true
|
4
|
+
|
5
|
+
validates :uid, :provider, presence: true
|
6
|
+
|
7
|
+
def self.find_or_initialize_with_omniauth(auth)
|
8
|
+
find_or_initialize_by uid: auth.uid, provider: auth.provider
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/config/routes.rb
CHANGED
data/lib/metova/api.rb
ADDED
@@ -9,10 +9,13 @@ module Metova
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def devise_mapping
|
12
|
-
_super = super
|
13
|
-
|
12
|
+
if _super = super
|
13
|
+
@_devise_mapping ||= ::Devise.mappings[_super.singular.to_s.gsub('api_', '').intern] || _super
|
14
|
+
else
|
15
|
+
_super
|
16
|
+
end
|
14
17
|
end
|
15
18
|
|
16
19
|
end
|
17
20
|
end
|
18
|
-
end
|
21
|
+
end
|
@@ -18,7 +18,6 @@ module Devise
|
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
|
-
|
22
21
|
def valid_token?(user)
|
23
22
|
!user.token_expired? && Devise.secure_compare(user.authentication_token, token)
|
24
23
|
end
|
@@ -34,7 +33,6 @@ module Devise
|
|
34
33
|
def token_and_options
|
35
34
|
@_token_and_options ||= ActionController::HttpAuthentication::Token.token_and_options(request) || []
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
37
|
end
|
40
|
-
end
|
38
|
+
end
|
data/lib/metova/engine.rb
CHANGED
@@ -6,5 +6,14 @@ module Metova
|
|
6
6
|
require 'devise'
|
7
7
|
require 'responders'
|
8
8
|
|
9
|
+
# run engine migrations when running bin/rake db:migrate from the main app
|
10
|
+
initializer :append_migrations do |app|
|
11
|
+
unless app.root.to_s.match root.to_s
|
12
|
+
config.paths['db/migrate'].expanded.each do |expanded_path|
|
13
|
+
app.config.paths['db/migrate'] << expanded_path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
9
18
|
end
|
10
19
|
end
|
data/lib/metova/error.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Metova
|
2
|
-
class
|
2
|
+
class GenericError
|
3
3
|
include ActiveModel::Model
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(error)
|
6
|
+
@error = error
|
7
7
|
end
|
8
8
|
|
9
9
|
def errors
|
10
|
-
[@
|
10
|
+
[@error]
|
11
11
|
end
|
12
12
|
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Metova
|
2
|
+
module Oauth
|
3
|
+
class FacebookProvider < GenericProvider
|
4
|
+
FACEBOOK_API_URL = 'https://graph.facebook.com/v2.3'
|
5
|
+
ME_URL = -> (token) { "#{FACEBOOK_API_URL}/me?access_token=#{token}" }
|
6
|
+
|
7
|
+
def authenticate
|
8
|
+
self.info = OmniAuth::AuthHash.new me
|
9
|
+
self.uid = info.id
|
10
|
+
self
|
11
|
+
end
|
12
|
+
|
13
|
+
def provider
|
14
|
+
:facebook
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def me
|
19
|
+
super do
|
20
|
+
JSON.parse URI.parse(ME_URL[access_token]).read
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Metova
|
2
|
+
module Oauth
|
3
|
+
class FluxProvider < GenericProvider
|
4
|
+
FLUX_API_URL = 'https://id.fluxhq.io/api/v1'
|
5
|
+
ME_URL = -> (token) { "#{FLUX_API_URL}/me?access_token=#{token}" }
|
6
|
+
|
7
|
+
def authenticate
|
8
|
+
self.info = OmniAuth::AuthHash.new me
|
9
|
+
self.uid = info.id
|
10
|
+
self
|
11
|
+
end
|
12
|
+
|
13
|
+
def provider
|
14
|
+
:flux
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def me
|
19
|
+
super do
|
20
|
+
JSON.parse URI.parse(ME_URL[access_token]).read
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Metova
|
2
|
+
module Oauth
|
3
|
+
class GenericProvider
|
4
|
+
attr_accessor :access_token, :token_secret, :uid, :provider, :info
|
5
|
+
|
6
|
+
def initialize(access_token, token_secret = nil)
|
7
|
+
@access_token = access_token
|
8
|
+
@token_secret = token_secret
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.authenticate(provider, access_token, token_secret = nil)
|
12
|
+
find_provider(provider).new(access_token, token_secret).authenticate
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def self.find_provider(provider)
|
17
|
+
map = {
|
18
|
+
twitter: Metova::Oauth::TwitterProvider,
|
19
|
+
facebook: Metova::Oauth::FacebookProvider,
|
20
|
+
google_oauth2: Metova::Oauth::GoogleProvider,
|
21
|
+
flux: Metova::Oauth::FluxProvider
|
22
|
+
}
|
23
|
+
|
24
|
+
map.fetch provider.to_sym
|
25
|
+
end
|
26
|
+
|
27
|
+
def me(&block)
|
28
|
+
yield
|
29
|
+
# rescue errors
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Metova
|
2
|
+
module Oauth
|
3
|
+
class TwitterProvider < GenericProvider
|
4
|
+
TWITTER_SITE_URL = 'https://api.twitter.com'
|
5
|
+
TWITTER_API_URL = 'https://api.twitter.com/1.1'
|
6
|
+
ME_URL = "#{TWITTER_API_URL}/account/verify_credentials.json?include_entities=false&skip_status=true"
|
7
|
+
|
8
|
+
def authenticate
|
9
|
+
self.info = OmniAuth::AuthHash.new me
|
10
|
+
self.uid = info.id
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def provider
|
15
|
+
:twitter
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def me
|
20
|
+
super do
|
21
|
+
JSON.parse(oauth_access_token.get(ME_URL).body)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def oauth_access_token
|
26
|
+
OAuth::AccessToken.from_hash consumer, oauth_token: access_token, oauth_token_secret: token_secret
|
27
|
+
end
|
28
|
+
|
29
|
+
def consumer
|
30
|
+
@consumer ||= begin
|
31
|
+
OAuth::Consumer.new(ENV['TWITTER_APP_ID'], ENV['TWITTER_APP_SECRET'], site: TWITTER_SITE_URL, scheme: :header)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/metova/oauth.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'metova'
|
2
|
+
require 'metova/oauth/generic_provider'
|
3
|
+
require 'metova/oauth/facebook_provider'
|
4
|
+
require 'metova/oauth/twitter_provider'
|
5
|
+
require 'metova/oauth/flux_provider'
|
6
|
+
require 'metova/oauth/google_provider'
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'omniauth'
|
10
|
+
rescue LoadError
|
11
|
+
raise "You've required metova/oauth but don't have omniauth! Install an omniauth provider first (ex: gem 'omniauth-twitter')"
|
12
|
+
end
|
data/lib/metova/responder.rb
CHANGED
@@ -4,9 +4,15 @@ module Metova
|
|
4
4
|
prepend Metova::Responders::PaginationResponder
|
5
5
|
prepend Metova::Responders::IdsFilterResponder
|
6
6
|
prepend Metova::Responders::SortResponder
|
7
|
-
|
7
|
+
prepend Metova::Responders::NestedAssociationResponder
|
8
|
+
include Metova::Responders::HttpCacheResponder
|
8
9
|
include ::Responders::FlashResponder
|
9
10
|
|
11
|
+
def initialize(*)
|
12
|
+
super
|
13
|
+
options[:location] = nil if format == :json
|
14
|
+
end
|
15
|
+
|
10
16
|
def to_format
|
11
17
|
validate!
|
12
18
|
if errors.any?
|
@@ -24,10 +30,8 @@ module Metova
|
|
24
30
|
end
|
25
31
|
|
26
32
|
private
|
27
|
-
|
28
33
|
def errors
|
29
34
|
@_errors ||= []
|
30
35
|
end
|
31
|
-
|
32
36
|
end
|
33
|
-
end
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Metova
|
2
|
+
module Responders
|
3
|
+
module HttpCacheResponder
|
4
|
+
|
5
|
+
def initialize(*)
|
6
|
+
super
|
7
|
+
@_cache = options.delete :cache
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_json
|
11
|
+
return if http_cache? and http_cache!
|
12
|
+
to_format
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def http_cache?
|
17
|
+
get? and persisted? and ActionController::Base.perform_caching and
|
18
|
+
resource.respond_to?(:cache_key) and (@_cache != false) and
|
19
|
+
controller.params[:cache] != false
|
20
|
+
end
|
21
|
+
|
22
|
+
def http_cache!
|
23
|
+
controller.fresh_when resource
|
24
|
+
end
|
25
|
+
|
26
|
+
def persisted?
|
27
|
+
resource.respond_to?(:persisted?) ? resource.persisted? : true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -22,7 +22,6 @@ module Metova
|
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
|
-
|
26
25
|
def paginate(resource)
|
27
26
|
resource.page(current_page).per(controller.params[:limit])
|
28
27
|
end
|
@@ -54,7 +53,6 @@ module Metova
|
|
54
53
|
def last_page
|
55
54
|
@_last_page ||= @resource.total_pages
|
56
55
|
end
|
57
|
-
|
58
56
|
end
|
59
57
|
end
|
60
|
-
end
|
58
|
+
end
|
@@ -8,7 +8,6 @@ module Metova
|
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
|
-
|
12
11
|
def search(resource, query = {})
|
13
12
|
if fuzzy?
|
14
13
|
resource.fuzzy_search query, exclusive?
|
@@ -36,9 +35,8 @@ module Metova
|
|
36
35
|
true
|
37
36
|
end
|
38
37
|
end
|
39
|
-
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
43
41
|
|
44
|
-
Metova::Responder.send :prepend, Metova::Responders::SearchResponder
|
42
|
+
Metova::Responder.send :prepend, Metova::Responders::SearchResponder
|
@@ -8,7 +8,6 @@ module Metova
|
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
|
-
|
12
11
|
def sort(resource)
|
13
12
|
resource.order(field_to_order_by => direction)
|
14
13
|
end
|
@@ -24,7 +23,6 @@ module Metova
|
|
24
23
|
def direction
|
25
24
|
controller.params.fetch(:direction, :asc)
|
26
25
|
end
|
27
|
-
|
28
26
|
end
|
29
27
|
end
|
30
|
-
end
|
28
|
+
end
|
data/lib/metova/version.rb
CHANGED
data/lib/metova.rb
CHANGED
@@ -4,6 +4,8 @@ require 'metova/error'
|
|
4
4
|
require 'metova/responders/pagination_responder'
|
5
5
|
require 'metova/responders/ids_filter_responder'
|
6
6
|
require 'metova/responders/sort_responder'
|
7
|
+
require 'metova/responders/nested_association_responder'
|
8
|
+
require 'metova/responders/http_cache_responder'
|
7
9
|
require 'metova/responder'
|
8
10
|
|
9
11
|
require 'metova/versioning/unsupported_version_app'
|
metadata
CHANGED
@@ -1,141 +1,225 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metova
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Serman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: kaminari
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.16.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.16.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: devise
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 3.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 3.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: responders
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sqlite3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec-rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: capybara
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: textacular
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ! '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ! '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: pg
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ! '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ! '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: refile
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: omniauth
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: omniauth-twitter
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: launchy
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ! '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ! '>='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: webmock
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ! '>='
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ! '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: aws-sdk
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - <
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '2'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - <
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '2'
|
139
223
|
description: Metova libraries for Ruby on Rails
|
140
224
|
email:
|
141
225
|
- loganserman@gmail.com
|
@@ -147,13 +231,18 @@ files:
|
|
147
231
|
- Rakefile
|
148
232
|
- app/assets/javascripts/metova/application.js
|
149
233
|
- app/assets/stylesheets/metova/application.css
|
234
|
+
- app/controllers/metova/api/sessions_controller.rb
|
150
235
|
- app/controllers/metova/application_controller.rb
|
236
|
+
- app/controllers/metova/omniauth_callbacks_controller.rb
|
237
|
+
- app/controllers/metova/registrations_controller.rb
|
238
|
+
- app/controllers/metova/s3_controller.rb
|
151
239
|
- app/helpers/metova/application_helper.rb
|
240
|
+
- app/models/metova/identity.rb
|
152
241
|
- app/views/layouts/metova/application.html.erb
|
153
242
|
- config/routes.rb
|
243
|
+
- db/migrate/20150620175834_create_metova_identities.rb
|
154
244
|
- lib/metova.rb
|
155
|
-
- lib/metova/
|
156
|
-
- lib/metova/carrierwave/railtie.rb
|
245
|
+
- lib/metova/api.rb
|
157
246
|
- lib/metova/devise/controller.rb
|
158
247
|
- lib/metova/devise/models/token_authenticatable.rb
|
159
248
|
- lib/metova/devise/strategies/token_authenticatable.rb
|
@@ -162,8 +251,16 @@ files:
|
|
162
251
|
- lib/metova/mandrill.rb
|
163
252
|
- lib/metova/mandrill/railtie.rb
|
164
253
|
- lib/metova/models/filterable.rb
|
254
|
+
- lib/metova/oauth.rb
|
255
|
+
- lib/metova/oauth/facebook_provider.rb
|
256
|
+
- lib/metova/oauth/flux_provider.rb
|
257
|
+
- lib/metova/oauth/generic_provider.rb
|
258
|
+
- lib/metova/oauth/google_provider.rb
|
259
|
+
- lib/metova/oauth/twitter_provider.rb
|
165
260
|
- lib/metova/responder.rb
|
261
|
+
- lib/metova/responders/http_cache_responder.rb
|
166
262
|
- lib/metova/responders/ids_filter_responder.rb
|
263
|
+
- lib/metova/responders/nested_association_responder.rb
|
167
264
|
- lib/metova/responders/pagination_responder.rb
|
168
265
|
- lib/metova/responders/search_responder.rb
|
169
266
|
- lib/metova/responders/sort_responder.rb
|
@@ -184,19 +281,18 @@ require_paths:
|
|
184
281
|
- lib
|
185
282
|
required_ruby_version: !ruby/object:Gem::Requirement
|
186
283
|
requirements:
|
187
|
-
- -
|
284
|
+
- - ! '>='
|
188
285
|
- !ruby/object:Gem::Version
|
189
286
|
version: 2.0.0
|
190
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
288
|
requirements:
|
192
|
-
- -
|
289
|
+
- - ! '>='
|
193
290
|
- !ruby/object:Gem::Version
|
194
291
|
version: '0'
|
195
292
|
requirements: []
|
196
293
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.
|
294
|
+
rubygems_version: 2.4.5
|
198
295
|
signing_key:
|
199
296
|
specification_version: 4
|
200
297
|
summary: Metova libraries for Ruby on Rails
|
201
298
|
test_files: []
|
202
|
-
has_rdoc:
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'carrierwave'
|
2
|
-
|
3
|
-
module Metova
|
4
|
-
module Carrierwave
|
5
|
-
class Railtie < ::Rails::Railtie
|
6
|
-
initializer "metova.carrierwave" do |_|
|
7
|
-
|
8
|
-
if ENV['AWS_S3_BUCKET_NAME'] && ENV['AWS_S3_ACCESS_KEY_ID'] && ENV['AWS_S3_SECRET_ACCESS_KEY']
|
9
|
-
CarrierWave.configure do |config|
|
10
|
-
config.storage = :fog
|
11
|
-
config.fog_directory = ENV['AWS_S3_BUCKET_NAME']
|
12
|
-
config.fog_public = true
|
13
|
-
config.fog_attributes = { 'Cache-Control' => 'max-age=315576000' }
|
14
|
-
config.fog_credentials = {
|
15
|
-
provider: 'AWS',
|
16
|
-
aws_access_key_id: ENV['AWS_S3_ACCESS_KEY_ID'],
|
17
|
-
aws_secret_access_key: ENV['AWS_S3_SECRET_ACCESS_KEY']
|
18
|
-
}
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
if ENV['CLOUDFRONT_URL']
|
23
|
-
CarrierWave.configure do |config|
|
24
|
-
config.asset_host = ENV['CLOUDFRONT_URL']
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
if Rails.env.test?
|
29
|
-
CarrierWave.configure do |config|
|
30
|
-
config.storage = :file
|
31
|
-
config.enable_processing = false
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/metova/carrierwave.rb
DELETED