onlinegames_info_connect 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/images/onlinegames_info_connect/ogi_small_logo.png +0 -0
- data/app/assets/javascripts/onlinegames_info_connect/utils.js.coffee +35 -0
- data/app/controllers/application_controller.rb +2 -0
- data/app/controllers/control_center/languages_controller.rb +90 -0
- data/app/controllers/control_center/user_roles_controller.rb +88 -0
- data/app/controllers/control_center/users_controller.rb +103 -0
- data/app/controllers/session_controller.rb +113 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/helpers/session_helper.rb +2 -0
- data/app/models/base_user.rb +54 -0
- data/app/models/language.rb +3 -0
- data/app/models/user_event.rb +16 -0
- data/app/models/user_role.rb +4 -0
- data/app/views/control_center/dashboard.html.erb +5 -0
- data/app/views/control_center/languages/_form.html.erb +25 -0
- data/app/views/control_center/languages/edit.html.erb +6 -0
- data/app/views/control_center/languages/index.html.erb +22 -0
- data/app/views/control_center/languages/new.html.erb +5 -0
- data/app/views/control_center/languages/show.html.erb +13 -0
- data/app/views/control_center/user_roles/_form.html.erb +25 -0
- data/app/views/control_center/user_roles/edit.html.erb +6 -0
- data/app/views/control_center/user_roles/index.html.erb +25 -0
- data/app/views/control_center/user_roles/new.html.erb +5 -0
- data/app/views/control_center/user_roles/show.html.erb +15 -0
- data/app/views/control_center/users/_form.html.erb +14 -0
- data/app/views/control_center/users/edit.html.erb +6 -0
- data/app/views/control_center/users/index.html.erb +56 -0
- data/app/views/control_center/users/show.html.erb +95 -0
- data/app/views/layouts/admin.html.erb +45 -0
- data/app/views/layouts/none.html.erb +1 -0
- data/app/views/layouts/simple.html.erb +5 -0
- data/app/views/session/_signup.html.erb +31 -0
- data/app/views/session/index.html.erb +4 -0
- data/config/routes.rb +23 -0
- data/db/migrate/20100604210033_create_users.rb +87 -0
- data/db/migrate/20100604222947_create_languages.rb +13 -0
- data/db/migrate/20100607191655_create_guilds.rb +26 -0
- data/db/migrate/20100612173309_create_user_roles.rb +14 -0
- data/lib/onlinegames_info_connect.rb +4 -0
- data/lib/onlinegames_info_connect/authenticated_system.rb +91 -0
- data/lib/onlinegames_info_connect/engine.rb +14 -0
- data/lib/onlinegames_info_connect/oauth_friends.rb +24 -0
- data/lib/onlinegames_info_connect/oauth_guild.rb +19 -0
- data/lib/onlinegames_info_connect/oauth_medals.rb +11 -0
- data/lib/onlinegames_info_connect/oauth_messages.rb +21 -0
- data/lib/onlinegames_info_connect/oauth_premium.rb +43 -0
- data/lib/onlinegames_info_connect/oauth_users.rb +11 -0
- data/lib/onlinegames_info_connect/ogi_oauth.rb +35 -0
- data/lib/onlinegames_info_connect/ogi_token_api.rb +49 -0
- data/lib/onlinegames_info_connect/test_helper.rb +7 -0
- data/lib/onlinegames_info_connect/version.rb +3 -0
- data/lib/tasks/onlinegames_info_connect_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +49 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +5 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/oauth_mock.rb +167 -0
- data/test/onlinegames_info_connect_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +214 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr.
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = '690f9f58ff40563de5feb4197746d2371dbd6d69a345e7e087a7073a82840d11b7306efd4e1c5c25a0c74f4fd0ef8817dc1af93e6fed8a0f6bafad006d64f0b6'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
# See how all your routes lay out with "rake routes".
|
4
|
+
|
5
|
+
# You can have the root of your site routed with "root"
|
6
|
+
# root 'welcome#index'
|
7
|
+
|
8
|
+
# Example of regular route:
|
9
|
+
# get 'products/:id' => 'catalog#view'
|
10
|
+
|
11
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
12
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
13
|
+
|
14
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
15
|
+
# resources :products
|
16
|
+
|
17
|
+
# Example resource route with options:
|
18
|
+
# resources :products do
|
19
|
+
# member do
|
20
|
+
# get 'short'
|
21
|
+
# post 'toggle'
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# collection do
|
25
|
+
# get 'sold'
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
|
29
|
+
# Example resource route with sub-resources:
|
30
|
+
# resources :products do
|
31
|
+
# resources :comments, :sales
|
32
|
+
# resource :seller
|
33
|
+
# end
|
34
|
+
|
35
|
+
# Example resource route with more complex sub-resources:
|
36
|
+
# resources :products do
|
37
|
+
# resources :comments
|
38
|
+
# resources :sales do
|
39
|
+
# get 'recent', on: :collection
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
43
|
+
# Example resource route within a namespace:
|
44
|
+
# namespace :admin do
|
45
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
46
|
+
# # (app/controllers/admin/products_controller.rb)
|
47
|
+
# resources :products
|
48
|
+
# end
|
49
|
+
end
|
File without changes
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/404.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/422.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/500.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
54
|
+
</div>
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
56
|
+
</body>
|
57
|
+
</html>
|
File without changes
|
data/test/oauth_mock.rb
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
module OnlinegamesInfoConnect
|
2
|
+
module OauthUsers
|
3
|
+
# Create a mock response
|
4
|
+
def me(token)
|
5
|
+
{'id' => OnlinegamesInfoConnect::OgiOauth.instance.get_user_id_by_token(token), 'name' => Faker::Name.name, 'language' => 'de', 'email' => Faker::Internet.email}
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_user(ip, login, email, password, campaign, language)
|
9
|
+
{'status' => 'ok', 'url' => 'http://test.onlinegamesinfo.com/app_login?token=123123'}
|
10
|
+
end
|
11
|
+
|
12
|
+
def set_user_name(user, char_name)
|
13
|
+
{'status' => 'ok'}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module OauthPremium
|
18
|
+
def add_free_coins(user, amount, reason)
|
19
|
+
{'status' => 'ok'}
|
20
|
+
end
|
21
|
+
|
22
|
+
def balance(user)
|
23
|
+
{'status' => 'ok', 'coins' => '300', 'last_payment' => {
|
24
|
+
id: 1, channel_id: 1, user_id: user.id, character_id: user.char_id, payment_transaction_type: 'test', payment_transaction_id: 1,
|
25
|
+
is_ok: true, client_application_id: 1, amount: 99, coins: '1', pay_type: 'TEST', created_at: Time.now, updated_at: Time.now}}
|
26
|
+
end
|
27
|
+
|
28
|
+
def buy_coins(user, ip)
|
29
|
+
{'status' => 'ok'}
|
30
|
+
end
|
31
|
+
|
32
|
+
def buy(user, buy_data)
|
33
|
+
{'status' => 'ok', 'coins' => '300'}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Create a mock response
|
37
|
+
def payment_history_redirect(user, ip)
|
38
|
+
{'url' => 'http://de.lvh.me:3000/test/payment'}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module OauthGuild
|
43
|
+
def create_guild(guild, user)
|
44
|
+
{'status' => 'ok', 'channel_id' => '1'}
|
45
|
+
end
|
46
|
+
|
47
|
+
def remove_guild(guild, user)
|
48
|
+
{'status' => 'ok'}
|
49
|
+
end
|
50
|
+
|
51
|
+
def add_user(guild, user, new_member)
|
52
|
+
{'status' => 'ok'}
|
53
|
+
end
|
54
|
+
|
55
|
+
def remove_user_from_guild(guild, user, member)
|
56
|
+
{'status' => 'ok'}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
module OauthMessages
|
61
|
+
|
62
|
+
def messages_index(user, mailbox)
|
63
|
+
return {'status' => 'ok', 'messages' => {}}
|
64
|
+
end
|
65
|
+
|
66
|
+
def messages_show(user, message_id)
|
67
|
+
return {'status' => 'ok', 'message' => {
|
68
|
+
'created_at' => Time.now.to_i, 'to_id_names' => 'Recipient', 'subject' => 'Subject', 'message' => 'Lorem ipsum',
|
69
|
+
'id' => message_id, 'from_user' => 'Sender'}}
|
70
|
+
end
|
71
|
+
|
72
|
+
def messages_destroy(user, message_id)
|
73
|
+
return {'status' => 'ok'}
|
74
|
+
end
|
75
|
+
|
76
|
+
def messages_create(user, ip, message_type, to_char_id, to_unknown, subject, msg_text)
|
77
|
+
return {'status' => 'ok'}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
module OauthFriends
|
82
|
+
|
83
|
+
def friends_index(user)
|
84
|
+
{'status' => 'ok', friends: {}}
|
85
|
+
end
|
86
|
+
|
87
|
+
def friends_show(user, friend_id)
|
88
|
+
{'status' => 'ok', friend: {}}
|
89
|
+
end
|
90
|
+
|
91
|
+
def friends_destroy(user, friend_id)
|
92
|
+
{'status' => 'ok'}
|
93
|
+
end
|
94
|
+
|
95
|
+
def friends_create(user, to_char_id, to_unknown)
|
96
|
+
{'status' => 'ok'}
|
97
|
+
end
|
98
|
+
|
99
|
+
def friends_confirm(user, friend_id)
|
100
|
+
{'status' => 'ok'}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
class TestToken
|
105
|
+
attr_accessor :token
|
106
|
+
end
|
107
|
+
|
108
|
+
# Tokens for users
|
109
|
+
# Auth codes to get user
|
110
|
+
module MockOgiOauth
|
111
|
+
@@mock_tokens = {}
|
112
|
+
@@mock_auth_codes = {}
|
113
|
+
|
114
|
+
def authorize(callback)
|
115
|
+
'http://www.example.com/oauth'
|
116
|
+
end
|
117
|
+
|
118
|
+
def get_token(auth_code, callback)
|
119
|
+
@@mock_auth_codes[auth_code]
|
120
|
+
end
|
121
|
+
|
122
|
+
def generate_auth_code(id)
|
123
|
+
auth_code = SecureRandom.hex(8)
|
124
|
+
token = TestToken.new
|
125
|
+
token.token = SecureRandom.hex(8)
|
126
|
+
@@mock_tokens[token] = id
|
127
|
+
@@mock_auth_codes[auth_code] = token
|
128
|
+
return auth_code
|
129
|
+
end
|
130
|
+
|
131
|
+
def get_user_id_by_token(token)
|
132
|
+
@@mock_tokens[token].nil? ? 1 : @@mock_tokens[token]
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
module MockOgiTokenApi
|
138
|
+
def track_action(user, action, amount=1)
|
139
|
+
return {'status' => 'ok'}
|
140
|
+
end
|
141
|
+
|
142
|
+
def short_messages_create(user, messages)
|
143
|
+
return {'status' => 'ok'}
|
144
|
+
end
|
145
|
+
|
146
|
+
def short_messages_create_alliance(messages)
|
147
|
+
return {'status' => 'ok'}
|
148
|
+
end
|
149
|
+
|
150
|
+
# to_char_language_map => {char_id => language, char_id2 => language}
|
151
|
+
# msg_texts => {language => test, language => text}
|
152
|
+
def messages_create_system_message(to_char_language_map, message_type, subjects, msg_texts)
|
153
|
+
return {'status' => 'ok'}
|
154
|
+
end
|
155
|
+
|
156
|
+
def ranking_update_ogi(char_data)
|
157
|
+
return {'status' => 'ok'}
|
158
|
+
end
|
159
|
+
|
160
|
+
def logout_page(user, ip)
|
161
|
+
return {'status' => 'ok', 'url' => 'http://test.onlinegamesinfo.com'}
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
OnlinegamesInfoConnect::OgiOauth.instance.extend(OnlinegamesInfoConnect::MockOgiOauth)
|
167
|
+
OnlinegamesInfoConnect::OgiTokenApi.instance.extend(OnlinegamesInfoConnect::MockOgiTokenApi)
|