disqus_rails 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- metadata +36 -79
- data/.gitignore +0 -18
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -296
- data/Rakefile +0 -1
- data/disqus_rails.gemspec +0 -27
- data/lib/disqus_rails.rb +0 -31
- data/lib/disqus_rails/active_record/acts_as_disqusable.rb +0 -24
- data/lib/disqus_rails/active_record/acts_as_disquser.rb +0 -48
- data/lib/disqus_rails/api.rb +0 -79
- data/lib/disqus_rails/api.yml +0 -855
- data/lib/disqus_rails/category.rb +0 -20
- data/lib/disqus_rails/collection.rb +0 -90
- data/lib/disqus_rails/forum.rb +0 -54
- data/lib/disqus_rails/helpers.rb +0 -65
- data/lib/disqus_rails/model.rb +0 -45
- data/lib/disqus_rails/post.rb +0 -106
- data/lib/disqus_rails/thread.rb +0 -130
- data/lib/disqus_rails/user.rb +0 -68
- data/lib/disqus_rails/version.rb +0 -3
- data/spec/disqus_rails/active_record/acts_as_disqusable_spec.rb +0 -118
- data/spec/disqus_rails/active_record/acts_as_disquser_spec.rb +0 -44
- data/spec/disqus_rails/api_spec.rb +0 -266
- data/spec/disqus_rails/category_spec.rb +0 -77
- data/spec/disqus_rails/collection_spec.rb +0 -9
- data/spec/disqus_rails/forum_spec.rb +0 -102
- data/spec/disqus_rails/model_spec.rb +0 -24
- data/spec/disqus_rails/post_spec.rb +0 -218
- data/spec/disqus_rails/thread_spec.rb +0 -174
- data/spec/disqus_rails/user_spec.rb +0 -101
- data/spec/disqus_rails_spec.rb +0 -17
- data/spec/spec_helper.rb +0 -13
- data/vendor/assets/javascripts/disqus_rails.js.coffee +0 -78
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe DisqusRails::User do
|
4
|
-
let!(:user_hash) do
|
5
|
-
{
|
6
|
-
:code => 0,
|
7
|
-
:response => {
|
8
|
-
"username" => "disqus_api",
|
9
|
-
"about" => "",
|
10
|
-
"name" => "disqus_api",
|
11
|
-
"url" => "",
|
12
|
-
"isFollowing" => false,
|
13
|
-
"isFollowedBy" => false,
|
14
|
-
"profileUrl" => "http://disqus.com/disqus_api/",
|
15
|
-
"emailHash" => "67f79ed8e10b74abf07a8dfe101bbab2",
|
16
|
-
"avatar" => {
|
17
|
-
"permalink" => "http://disqus.com/api/users/avatars/disqus_api.jpg",
|
18
|
-
"cache" => "http://mediacdn.disqus.com/1091/images/noavatar92.png"
|
19
|
-
}
|
20
|
-
},
|
21
|
-
:id => "1",
|
22
|
-
:isAnonymous => false,
|
23
|
-
:email => "example@disqus.com"
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
let(:user){ DisqusRails::User.new(user_hash[:response]) }
|
28
|
-
|
29
|
-
let(:empty_collection_hash) do
|
30
|
-
{
|
31
|
-
:cursor => {
|
32
|
-
"prev" => "null",
|
33
|
-
"hasNext" => true,
|
34
|
-
"next" => "1368581473195442:0:0",
|
35
|
-
"hasPrev" => false,
|
36
|
-
"total" => "null",
|
37
|
-
"id" => "1368581473195442:0:0",
|
38
|
-
"more" => true
|
39
|
-
},
|
40
|
-
:code => 0,
|
41
|
-
:response => []
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should get user details information with find method" do
|
46
|
-
DisqusRails::Api::Users
|
47
|
-
.should_receive(:details)
|
48
|
-
.with(:user => 1)
|
49
|
-
.and_return(user_hash)
|
50
|
-
|
51
|
-
DisqusRails::User.find(1).should be_a_kind_of(DisqusRails::User)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should get user forums as DisqusRails::Forums class instance" do
|
55
|
-
DisqusRails::Api::Users
|
56
|
-
.should_receive(:listForums)
|
57
|
-
.and_return(empty_collection_hash)
|
58
|
-
|
59
|
-
user.forums.should be_a_kind_of(DisqusRails::Forums)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should get user active forums as DisqusRails::Forums class instance" do
|
63
|
-
DisqusRails::Api::Users
|
64
|
-
.should_receive(:listActiveForums)
|
65
|
-
.and_return(empty_collection_hash)
|
66
|
-
|
67
|
-
user.active_forums.should be_a_kind_of(DisqusRails::Forums)
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should get user active threads as DisqusRails::Threads class instance" do
|
71
|
-
DisqusRails::Api::Users
|
72
|
-
.should_receive(:listActiveThreads)
|
73
|
-
.and_return(empty_collection_hash)
|
74
|
-
|
75
|
-
user.active_threads.should be_a_kind_of(DisqusRails::Threads)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should get user posts as DisqusRails::Posts class instance" do
|
79
|
-
DisqusRails::Api::Users
|
80
|
-
.should_receive(:listPosts)
|
81
|
-
.and_return(empty_collection_hash)
|
82
|
-
|
83
|
-
user.posts.should be_a_kind_of(DisqusRails::Posts)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should get user followers as DisqusRails::Users class instance" do
|
87
|
-
DisqusRails::Api::Users
|
88
|
-
.should_receive(:listFollowers)
|
89
|
-
.and_return(empty_collection_hash)
|
90
|
-
|
91
|
-
user.followers.should be_a_kind_of(DisqusRails::Users)
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should get users following users as DisqusRails::Users class instance" do
|
95
|
-
DisqusRails::Api::Users
|
96
|
-
.should_receive(:listFollowing)
|
97
|
-
.and_return(empty_collection_hash)
|
98
|
-
|
99
|
-
user.following.should be_a_kind_of(DisqusRails::Users)
|
100
|
-
end
|
101
|
-
end
|
data/spec/disqus_rails_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe DisqusRails do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
DisqusRails.setup do |config|
|
7
|
-
config::SHORT_NAME = "stubbed_short_name"
|
8
|
-
config::SECRET_KEY = "stubbed_secret_key"
|
9
|
-
config::PUBLIC_KEY = "stubbed_public_key"
|
10
|
-
config::ACCESS_TOKEN = "stubbed_access_token"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
%w(SHORT_NAME SECRET_KEY PUBLIC_KEY ACCESS_TOKEN).each do |config_const|
|
15
|
-
it { should be_const_defined config_const }
|
16
|
-
end
|
17
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
class @DisqusRails
|
2
|
-
|
3
|
-
constructor: (attributes)->
|
4
|
-
@short_name = attributes['short_name']
|
5
|
-
@public_key = attributes['public_key']
|
6
|
-
@sso = attributes['sso']
|
7
|
-
|
8
|
-
if attributes['remote_auth_s3'] then @remote_auth_s3 = attributes['remote_auth_s3']
|
9
|
-
if attributes['reset'] then reset = attributes['reset']
|
10
|
-
|
11
|
-
@registerDisqusConfig()
|
12
|
-
|
13
|
-
if reset
|
14
|
-
@isResetting = false
|
15
|
-
@registerResetFunction()
|
16
|
-
|
17
|
-
reset: ->
|
18
|
-
unless @isResetting
|
19
|
-
@isResetting = true
|
20
|
-
that = this
|
21
|
-
DISQUS.reset
|
22
|
-
reload: true
|
23
|
-
config: ->
|
24
|
-
this.page.identifier = that.disqusable_id
|
25
|
-
this.page.title = that.disqusable_title
|
26
|
-
|
27
|
-
registerResetFunction: ->
|
28
|
-
$(document).on "disqus:on_ready", =>
|
29
|
-
@reset()
|
30
|
-
|
31
|
-
registerDisqusConfig: ->
|
32
|
-
that = this
|
33
|
-
window.disqus_config = ->
|
34
|
-
if that.remote_auth_s3 && that.sso
|
35
|
-
this.page.remote_auth_s3 = that.remote_auth_s3
|
36
|
-
this.page.api_key = that.public_key
|
37
|
-
this.sso = that.sso
|
38
|
-
|
39
|
-
@callbacks.afterRender = [->
|
40
|
-
$(document).trigger "disqus:after_render"
|
41
|
-
]
|
42
|
-
@callbacks.onInit = [->
|
43
|
-
$(document).trigger "disqus:on_init"
|
44
|
-
]
|
45
|
-
@callbacks.onNewComment = [->
|
46
|
-
$(document).trigger "disqus:on_new_comment"
|
47
|
-
]
|
48
|
-
@callbacks.onPaginate = [->
|
49
|
-
$(document).trigger "disqus:on_paginate"
|
50
|
-
]
|
51
|
-
@callbacks.onReady = [->
|
52
|
-
$(document).trigger "disqus:on_ready"
|
53
|
-
]
|
54
|
-
@callbacks.preData = [->
|
55
|
-
$(document).trigger "disqus:pre_data"
|
56
|
-
]
|
57
|
-
@callbacks.preInit = [->
|
58
|
-
$(document).trigger "disqus:pre_init"
|
59
|
-
]
|
60
|
-
@callbacks.preReset = [->
|
61
|
-
$(document).trigger "disqus:pre_reset"
|
62
|
-
]
|
63
|
-
|
64
|
-
draw_thread: (disqusable_id, disqusable_title)->
|
65
|
-
|
66
|
-
@disqusable_id = disqusable_id
|
67
|
-
@disqusable_title = disqusable_title
|
68
|
-
|
69
|
-
window.disqus_shortname = @short_name
|
70
|
-
window.disqus_title = @disqusable_title || document.title
|
71
|
-
|
72
|
-
(->
|
73
|
-
dsq = document.createElement("script")
|
74
|
-
dsq.type = "text/javascript"
|
75
|
-
dsq.async = true
|
76
|
-
dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js"
|
77
|
-
(document.getElementsByTagName("head")[0] or document.getElementsByTagName("body")[0]).appendChild dsq
|
78
|
-
)()
|