stw_engine 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +97 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +40 -0
- data/app/assets/images/stw_engine/.gitkeep +0 -0
- data/app/assets/javascripts/posts.js +2 -0
- data/app/assets/javascripts/stw.js +2 -0
- data/app/assets/javascripts/stw_engine/.gitkeep +0 -0
- data/app/assets/stylesheets/posts.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/assets/stylesheets/stw.css +14 -0
- data/app/assets/stylesheets/stw_engine/.gitkeep +0 -0
- data/app/controllers/.gitkeep +0 -0
- data/app/controllers/posts_controller.rb +83 -0
- data/app/controllers/stw_controller.rb +4 -0
- data/app/helpers/.gitkeep +0 -0
- data/app/helpers/posts_helper.rb +2 -0
- data/app/helpers/stw_helper.rb +2 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/post.rb +3 -0
- data/app/views/.gitkeep +0 -0
- data/app/views/posts/_form.html.erb +25 -0
- data/app/views/posts/edit.html.erb +6 -0
- data/app/views/posts/index.html.erb +25 -0
- data/app/views/posts/new.html.erb +5 -0
- data/app/views/posts/show.html.erb +15 -0
- data/app/views/stw/index.html.erb +13 -0
- data/config/routes.rb +6 -0
- data/db/migrate/20131103153222_create_posts.rb +10 -0
- data/lib/stw_engine/config.rb +91 -0
- data/lib/stw_engine/engine.rb +6 -0
- data/lib/stw_engine/helpers/common.rb +159 -0
- data/lib/stw_engine/rails.rb +3 -0
- data/lib/stw_engine/version.rb +3 -0
- data/lib/stw_engine.rb +7 -0
- data/lib/tasks/stw_engine_tasks.rake +4 -0
- data/script/rails +8 -0
- data/stw_engine.gemspec +25 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/fixtures/posts.yml +9 -0
- data/test/functional/posts_controller_test.rb +49 -0
- data/test/functional/stw_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/stw_engine_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/unit/helpers/stw_helper_test.rb +4 -0
- data/test/unit/post_test.rb +7 -0
- metadata +186 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in stw_engine.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# jquery-rails is used by the dummy application
|
9
|
+
gem "jquery-rails"
|
10
|
+
|
11
|
+
# Declare any dependencies that are still in development here instead of in
|
12
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
+
# your gem to rubygems.org.
|
15
|
+
|
16
|
+
# To use debugger
|
17
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
stw_engine (0.0.1)
|
5
|
+
rails (~> 3.2.13)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (3.2.15)
|
11
|
+
actionpack (= 3.2.15)
|
12
|
+
mail (~> 2.5.4)
|
13
|
+
actionpack (3.2.15)
|
14
|
+
activemodel (= 3.2.15)
|
15
|
+
activesupport (= 3.2.15)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
journey (~> 1.0.4)
|
19
|
+
rack (~> 1.4.5)
|
20
|
+
rack-cache (~> 1.2)
|
21
|
+
rack-test (~> 0.6.1)
|
22
|
+
sprockets (~> 2.2.1)
|
23
|
+
activemodel (3.2.15)
|
24
|
+
activesupport (= 3.2.15)
|
25
|
+
builder (~> 3.0.0)
|
26
|
+
activerecord (3.2.15)
|
27
|
+
activemodel (= 3.2.15)
|
28
|
+
activesupport (= 3.2.15)
|
29
|
+
arel (~> 3.0.2)
|
30
|
+
tzinfo (~> 0.3.29)
|
31
|
+
activeresource (3.2.15)
|
32
|
+
activemodel (= 3.2.15)
|
33
|
+
activesupport (= 3.2.15)
|
34
|
+
activesupport (3.2.15)
|
35
|
+
i18n (~> 0.6, >= 0.6.4)
|
36
|
+
multi_json (~> 1.0)
|
37
|
+
arel (3.0.2)
|
38
|
+
builder (3.0.4)
|
39
|
+
erubis (2.7.0)
|
40
|
+
hike (1.2.3)
|
41
|
+
i18n (0.6.5)
|
42
|
+
journey (1.0.4)
|
43
|
+
jquery-rails (3.0.4)
|
44
|
+
railties (>= 3.0, < 5.0)
|
45
|
+
thor (>= 0.14, < 2.0)
|
46
|
+
json (1.8.1)
|
47
|
+
mail (2.5.4)
|
48
|
+
mime-types (~> 1.16)
|
49
|
+
treetop (~> 1.4.8)
|
50
|
+
mime-types (1.25)
|
51
|
+
multi_json (1.8.2)
|
52
|
+
polyglot (0.3.3)
|
53
|
+
rack (1.4.5)
|
54
|
+
rack-cache (1.2)
|
55
|
+
rack (>= 0.4)
|
56
|
+
rack-ssl (1.3.3)
|
57
|
+
rack
|
58
|
+
rack-test (0.6.2)
|
59
|
+
rack (>= 1.0)
|
60
|
+
rails (3.2.15)
|
61
|
+
actionmailer (= 3.2.15)
|
62
|
+
actionpack (= 3.2.15)
|
63
|
+
activerecord (= 3.2.15)
|
64
|
+
activeresource (= 3.2.15)
|
65
|
+
activesupport (= 3.2.15)
|
66
|
+
bundler (~> 1.0)
|
67
|
+
railties (= 3.2.15)
|
68
|
+
railties (3.2.15)
|
69
|
+
actionpack (= 3.2.15)
|
70
|
+
activesupport (= 3.2.15)
|
71
|
+
rack-ssl (~> 1.3.2)
|
72
|
+
rake (>= 0.8.7)
|
73
|
+
rdoc (~> 3.4)
|
74
|
+
thor (>= 0.14.6, < 2.0)
|
75
|
+
rake (10.1.0)
|
76
|
+
rdoc (3.12.2)
|
77
|
+
json (~> 1.4)
|
78
|
+
sprockets (2.2.2)
|
79
|
+
hike (~> 1.2)
|
80
|
+
multi_json (~> 1.0)
|
81
|
+
rack (~> 1.0)
|
82
|
+
tilt (~> 1.1, != 1.3.0)
|
83
|
+
sqlite3 (1.3.8)
|
84
|
+
thor (0.18.1)
|
85
|
+
tilt (1.4.1)
|
86
|
+
treetop (1.4.15)
|
87
|
+
polyglot
|
88
|
+
polyglot (>= 0.3.1)
|
89
|
+
tzinfo (0.3.38)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
jquery-rails
|
96
|
+
sqlite3
|
97
|
+
stw_engine!
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'StwEngine'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
File without changes
|
File without changes
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
File without changes
|
File without changes
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
# GET /posts
|
3
|
+
# GET /posts.json
|
4
|
+
def index
|
5
|
+
@posts = Post.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @posts }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /posts/1
|
14
|
+
# GET /posts/1.json
|
15
|
+
def show
|
16
|
+
@post = Post.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @post }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /posts/new
|
25
|
+
# GET /posts/new.json
|
26
|
+
def new
|
27
|
+
@post = Post.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render json: @post }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /posts/1/edit
|
36
|
+
def edit
|
37
|
+
@post = Post.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /posts
|
41
|
+
# POST /posts.json
|
42
|
+
def create
|
43
|
+
@post = Post.new(params[:post])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @post.save
|
47
|
+
format.html { redirect_to @post, notice: 'Post was successfully created.' }
|
48
|
+
format.json { render json: @post, status: :created, location: @post }
|
49
|
+
else
|
50
|
+
format.html { render action: "new" }
|
51
|
+
format.json { render json: @post.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /posts/1
|
57
|
+
# PUT /posts/1.json
|
58
|
+
def update
|
59
|
+
@post = Post.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @post.update_attributes(params[:post])
|
63
|
+
format.html { redirect_to @post, notice: 'Post was successfully updated.' }
|
64
|
+
format.json { head :no_content }
|
65
|
+
else
|
66
|
+
format.html { render action: "edit" }
|
67
|
+
format.json { render json: @post.errors, status: :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /posts/1
|
73
|
+
# DELETE /posts/1.json
|
74
|
+
def destroy
|
75
|
+
@post = Post.find(params[:id])
|
76
|
+
@post.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to posts_url }
|
80
|
+
format.json { head :no_content }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
File without changes
|
File without changes
|
data/app/models/.gitkeep
ADDED
File without changes
|
data/app/models/post.rb
ADDED
data/app/views/.gitkeep
ADDED
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_for(@post) do |f| %>
|
2
|
+
<% if @post.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :title %><br />
|
16
|
+
<%= f.text_field :title %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :text %><br />
|
20
|
+
<%= f.text_area :text %>
|
21
|
+
</div>
|
22
|
+
<div class="actions">
|
23
|
+
<%= f.submit %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h1>Listing posts</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Title</th>
|
6
|
+
<th>Text</th>
|
7
|
+
<th></th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
|
12
|
+
<% @posts.each do |post| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= post.title %></td>
|
15
|
+
<td><%= post.text %></td>
|
16
|
+
<td><%= link_to 'Show', post %></td>
|
17
|
+
<td><%= link_to 'Edit', edit_post_path(post) %></td>
|
18
|
+
<td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<br />
|
24
|
+
|
25
|
+
<%= link_to 'New Post', new_post_path %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= stylesheet_link_tag "stw" %>
|
2
|
+
<div style="width:350px;margin: 30px auto">
|
3
|
+
<h1>Stw Account Details</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<% stw_show_info.each do |key, value| %>
|
7
|
+
<tr>
|
8
|
+
<td><%= key %></td><td><%= value %></td>
|
9
|
+
</tr>
|
10
|
+
<% end %>
|
11
|
+
</table>
|
12
|
+
|
13
|
+
</div>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
module StwEngine
|
2
|
+
extend self
|
3
|
+
|
4
|
+
# modes
|
5
|
+
MODES = %w{production placehold dummy}
|
6
|
+
IMAGE_URL = 'http://images.shrinktheweb.com/xino.php?'
|
7
|
+
ACCOUNT_URL = 'http://images.shrinktheweb.com/account.php?'
|
8
|
+
|
9
|
+
def config c = {}
|
10
|
+
# mandatory
|
11
|
+
self.api_key = c[:api_key]
|
12
|
+
self.api_secret = c[:api_secret]
|
13
|
+
|
14
|
+
# optional
|
15
|
+
self.mode = c[:mode] if c[:mode]
|
16
|
+
self.api_version = c[:api_version] if c[:api_version]
|
17
|
+
self.api_url = c[:api_url] if c[:api_url]
|
18
|
+
end
|
19
|
+
|
20
|
+
def api_key=api_key
|
21
|
+
@api_key=api_key
|
22
|
+
end
|
23
|
+
|
24
|
+
def api_key
|
25
|
+
raise 'StwEngine error: No api_key defined!' if @api_key.nil?
|
26
|
+
@api_key
|
27
|
+
end
|
28
|
+
|
29
|
+
def api_secret=api_secret
|
30
|
+
@api_secret = api_secret
|
31
|
+
end
|
32
|
+
|
33
|
+
def api_secret
|
34
|
+
raise 'StwEngine error: No api secret defined!' if @api_secret.nil?
|
35
|
+
@api_secret
|
36
|
+
end
|
37
|
+
|
38
|
+
def mode=mode
|
39
|
+
raise "StwEngine error: Invalid mode, only #{ MODES.join(', ') } are allowed" unless MODES.include?(mode.to_s)
|
40
|
+
@mode = mode.to_s
|
41
|
+
end
|
42
|
+
|
43
|
+
def mode
|
44
|
+
@mode ||= 'production' # default: production
|
45
|
+
end
|
46
|
+
|
47
|
+
def api_version=api_version
|
48
|
+
@api_version = api_version || 'v6' # set default to latest open version
|
49
|
+
end
|
50
|
+
|
51
|
+
def api_version
|
52
|
+
@api_version || 'v6' #default: v6
|
53
|
+
end
|
54
|
+
|
55
|
+
def image_url=image_url
|
56
|
+
@image_url = image_url || IMAGE_URL
|
57
|
+
end
|
58
|
+
|
59
|
+
def image_url
|
60
|
+
# reference => http://url2png.com/docs/
|
61
|
+
# currently all versions suggest 'beta'
|
62
|
+
@image_url || IMAGE_URL
|
63
|
+
end
|
64
|
+
|
65
|
+
def account_url
|
66
|
+
@account_url = ACCOUNT_URL
|
67
|
+
end
|
68
|
+
|
69
|
+
def account_url=account_url
|
70
|
+
@account_url = ACCOUNT_URL
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
def default_size=default_size
|
76
|
+
@default_size = default_size || "400x400"
|
77
|
+
end
|
78
|
+
|
79
|
+
def default_size
|
80
|
+
@default_size || "400x400"
|
81
|
+
end
|
82
|
+
|
83
|
+
def token param
|
84
|
+
case self.api_version
|
85
|
+
when 'v6'
|
86
|
+
Digest::MD5.hexdigest("#{param}#{self.private_key}")
|
87
|
+
when 'v4', 'v3'
|
88
|
+
Digest::MD5.hexdigest("#{self.private_key}+#{param}")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|