disqus_api 0.0.3 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +8 -2
- data/Gemfile +0 -3
- data/LICENSE.txt +22 -0
- data/README.md +28 -3
- data/disqus_api.gemspec +11 -9
- data/lib/apis/3.0.yml +1 -0
- data/lib/disqus_api.rb +1 -1
- data/lib/disqus_api/railtie.rb +15 -0
- data/lib/version.rb +3 -0
- data/spec/disqus_api/api_spec.rb +13 -12
- data/spec/disqus_api/namespace_spec.rb +11 -11
- data/spec/disqus_api/request_spec.rb +3 -3
- data/spec/disqus_api/response_spec.rb +27 -30
- data/spec/disqus_api_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -1
- metadata +63 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 680fdaca9d9874f809704e83613e82ff3dbdb50eec0f6295ca72426ddb137311
|
4
|
+
data.tar.gz: 4904ff056b83514217510b2ca23ec8c895a880a39094226bcb59287dacda1335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3388a255eafd3517986afad347dae8b516fadeb1d717347d2e016fdb73689f4d9e0542cb28b21573d8bc9987c4c023394a5fb57cfd13bdcac8d68cdd4aea703e
|
7
|
+
data.tar.gz: 7ebeba6dc4a99d790cedc579d553ed6192e9d72d819fe860ed452568fe00f4adce15d2567bb86da3a0d4466912612203bae3a34ac80e2e5d076f16e7ac7bdafc
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 einzige
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# Disqus API for Ruby
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/disqus_api.png)](http://badge.fury.io/rb/disqus_api)
|
3
3
|
[![Build Status](https://travis-ci.org/toptal/disqus_api.png?branch=master)](https://travis-ci.org/toptal/disqus_api)
|
4
|
+
[![Code Climate](https://codeclimate.com/repos/52ab1c4c7e00a455db041687/badges/69e7a7201240be64f8de/gpa.png)](https://codeclimate.com/repos/52ab1c4c7e00a455db041687/feed)
|
4
5
|
|
5
6
|
Provides clean Disqus REST API for your Ruby app. Currently supported API version: 3.0.
|
6
7
|
|
7
|
-
|
8
|
+
Rails >3.0 is also supported.
|
8
9
|
|
9
10
|
## Install
|
10
11
|
|
@@ -14,6 +15,8 @@ gem install disqus_api
|
|
14
15
|
|
15
16
|
## Configure
|
16
17
|
|
18
|
+
If you are not using Rails:
|
19
|
+
|
17
20
|
```ruby
|
18
21
|
require 'disqus_api'
|
19
22
|
|
@@ -22,6 +25,24 @@ DisqusApi.config = {api_secret: 'secret key',
|
|
22
25
|
access_token: 'token from app settings'}
|
23
26
|
```
|
24
27
|
|
28
|
+
For **Rails** users:
|
29
|
+
|
30
|
+
Put in your `config/disqus_api.yml`:
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
development:
|
34
|
+
api_secret: development_secret_key
|
35
|
+
api_key: 'public key'
|
36
|
+
access_token: 'token from app settings'
|
37
|
+
|
38
|
+
production:
|
39
|
+
api_secret: production_secret_key
|
40
|
+
api_key: 'public key'
|
41
|
+
access_token: 'token from app settings'
|
42
|
+
|
43
|
+
# ... any other env
|
44
|
+
```
|
45
|
+
|
25
46
|
## Enjoy
|
26
47
|
|
27
48
|
```ruby
|
@@ -79,7 +100,7 @@ first_page = DisqusApi.v3.posts.list(forum: 'my_forum', limit: 10)
|
|
79
100
|
|
80
101
|
second_page = first_page.next
|
81
102
|
third_page = second_page.next
|
82
|
-
first_page =
|
103
|
+
first_page = third_page.prev.prev
|
83
104
|
# ...
|
84
105
|
```
|
85
106
|
|
@@ -165,7 +186,7 @@ rspec
|
|
165
186
|
rake # rake gem must be installed
|
166
187
|
```
|
167
188
|
|
168
|
-
In order to test on a real
|
189
|
+
In order to test on a real Disqus account
|
169
190
|
- specify `spec/config/disqus.yml` (see `spec/config/disqus.yml.example` for details)
|
170
191
|
- run specs passing `USE_DISQUS_ACCOUNT` environment variable:
|
171
192
|
|
@@ -182,3 +203,7 @@ USE_DISQUS_ACCOUNT=1 rspec
|
|
182
203
|
- Commit and push until you are happy with your contribution
|
183
204
|
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
184
205
|
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
206
|
+
|
207
|
+
------------
|
208
|
+
|
209
|
+
This project is licensed under the terms of the [MIT license](https://github.com/toptal/disqus_api/blob/master/LICENSE.txt).
|
data/disqus_api.gemspec
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/version', __FILE__)
|
2
3
|
|
3
4
|
Gem::Specification.new do |s|
|
4
5
|
s.name = %q{disqus_api}
|
5
|
-
s.version =
|
6
|
+
s.version = DisqusApi::VERSION
|
6
7
|
|
7
8
|
s.date = %q{2013-12-09}
|
8
|
-
s.authors = [
|
9
|
+
s.authors = ['Sergei Zinin (einzige)']
|
9
10
|
s.email = %q{szinin@gmail.com}
|
10
11
|
s.homepage = %q{http://github.com/toptal/disqus_api}
|
11
12
|
|
12
|
-
s.licenses = [
|
13
|
+
s.licenses = ['MIT']
|
13
14
|
|
14
15
|
s.files = `git ls-files`.split("\n")
|
15
|
-
s.require_paths = [
|
16
|
-
s.extra_rdoc_files = [
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
s.extra_rdoc_files = ['README.md']
|
17
18
|
|
18
19
|
s.description = %q{Provides clean Disqus API for your Ruby app with a nice interface.}
|
19
20
|
s.summary = %q{Disqus API for Ruby}
|
20
21
|
|
21
|
-
s.add_runtime_dependency 'activesupport'
|
22
|
-
s.add_runtime_dependency 'faraday',
|
23
|
-
s.add_runtime_dependency 'faraday_middleware',
|
22
|
+
s.add_runtime_dependency 'activesupport'
|
23
|
+
s.add_runtime_dependency 'faraday', '>= 0.9', '< 2.0'
|
24
|
+
s.add_runtime_dependency 'faraday_middleware', '>= 0.10', '< 2.0'
|
24
25
|
s.add_development_dependency 'rspec'
|
26
|
+
s.add_development_dependency 'rspec-its'
|
27
|
+
s.add_development_dependency 'rake'
|
25
28
|
end
|
26
|
-
|
data/lib/apis/3.0.yml
CHANGED
data/lib/disqus_api.rb
CHANGED
@@ -11,9 +11,9 @@ require 'disqus_api/namespace'
|
|
11
11
|
require 'disqus_api/request'
|
12
12
|
require 'disqus_api/response'
|
13
13
|
require 'disqus_api/invalid_api_request_error'
|
14
|
+
require 'disqus_api/railtie' if defined?(Rails)
|
14
15
|
|
15
16
|
module DisqusApi
|
16
|
-
VERSION = '0.0.3'
|
17
17
|
|
18
18
|
def self.adapter
|
19
19
|
@adapter || Faraday.default_adapter
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module DisqusApi
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
initializer 'disqus_api.initialize' do
|
4
|
+
config_path = Rails.root.join('config', 'disqus_api.yml')
|
5
|
+
|
6
|
+
if config_path.exist?
|
7
|
+
DisqusApi.config = YAML.load(ERB.new(config_path.read).result)[Rails.env]
|
8
|
+
else
|
9
|
+
unless Rails.env.test?
|
10
|
+
puts "WARNING: No config/disqus_api.yml provided for Disqus API. Make sure to set configuration manually."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/version.rb
ADDED
data/spec/disqus_api/api_spec.rb
CHANGED
@@ -6,24 +6,24 @@ describe DisqusApi::Api do
|
|
6
6
|
let(:version) { '3.0' }
|
7
7
|
let(:specifications) { {'users' => 'details'} }
|
8
8
|
|
9
|
-
its(:version) { should
|
10
|
-
its(:specifications) { should
|
9
|
+
its(:version) { should eq(version) }
|
10
|
+
its(:specifications) { should eq(specifications) }
|
11
11
|
its(:namespaces) { should have_key(:users) }
|
12
|
-
its(:endpoint) { should
|
12
|
+
its(:endpoint) { should eq('https://disqus.com/api/3.0/') }
|
13
13
|
it { should respond_to(:users) }
|
14
14
|
its(:users) { should be_a(DisqusApi::Namespace) }
|
15
|
-
its(:connection_options) { should
|
16
|
-
|
17
|
-
|
15
|
+
its(:connection_options) { should eq ({headers: {"Accept"=>"application/json", "User-Agent"=>"DisqusAgent"},
|
16
|
+
ssl: {verify: false},
|
17
|
+
url: "https://disqus.com/api/3.0/"}) }
|
18
18
|
|
19
19
|
describe "unregistered namespace metacalls" do
|
20
|
-
it {
|
20
|
+
it { is_expected.not_to respond_to(:foo) }
|
21
21
|
specify { expect { api.foo }.to raise_error(ArgumentError) }
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "#connection" do
|
25
25
|
subject { api.connection }
|
26
|
-
it {
|
26
|
+
it { is_expected.to be_a(Faraday::Connection) }
|
27
27
|
its(:params) { should have_key('api_key') }
|
28
28
|
its(:params) { should have_key('api_secret') }
|
29
29
|
its(:params) { should have_key('access_token') }
|
@@ -33,7 +33,7 @@ describe DisqusApi::Api do
|
|
33
33
|
let(:request_path) { '/api/3.0/users/details.json' }
|
34
34
|
|
35
35
|
it 'performs GET request' do
|
36
|
-
api.get(request_path)['code'].
|
36
|
+
expect(api.get(request_path)['code']).to eq(0)
|
37
37
|
end
|
38
38
|
|
39
39
|
context "invalid request" do
|
@@ -49,10 +49,11 @@ describe DisqusApi::Api do
|
|
49
49
|
describe "#post", perform_requests: true do
|
50
50
|
let(:request_type) { :post }
|
51
51
|
let(:request_path) { '/api/3.0/forums/create.json' }
|
52
|
+
let(:request_args) { {name: 'TestRspec', short_name: 'tspec', website: 'http://disqus.com'} } # no way!
|
52
53
|
|
53
|
-
context local: true do
|
54
|
+
context "local", local: true do
|
54
55
|
it 'performs POST request' do
|
55
|
-
api.post(request_path)['code'].
|
56
|
+
expect(api.post(request_path, request_args)['code']).to eq(0)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
@@ -65,4 +66,4 @@ describe DisqusApi::Api do
|
|
65
66
|
end
|
66
67
|
end
|
67
68
|
end
|
68
|
-
end
|
69
|
+
end
|
@@ -6,11 +6,11 @@ describe DisqusApi::Namespace do
|
|
6
6
|
let(:specifications) { {'users' => {'details' => 'get'}} }
|
7
7
|
|
8
8
|
let(:namespace_name) { 'users' }
|
9
|
-
subject(:namespace) {
|
9
|
+
subject(:namespace) { DisqusApi::Namespace.new(api, namespace_name) }
|
10
10
|
|
11
|
-
its(:api) {
|
12
|
-
its(:specification) {
|
13
|
-
its(:name) {
|
11
|
+
its(:api) { is_expected.to eq(api) }
|
12
|
+
its(:specification) { is_expected.to eq({'details' => 'get'}) }
|
13
|
+
its(:name) { is_expected.to eq(namespace_name) }
|
14
14
|
|
15
15
|
it { should respond_to :details }
|
16
16
|
|
@@ -21,26 +21,26 @@ describe DisqusApi::Namespace do
|
|
21
21
|
|
22
22
|
describe "#build_action_request" do
|
23
23
|
subject(:request) { namespace.build_action_request('details', {args: true}) }
|
24
|
-
its(:path) {
|
25
|
-
its(:api) {
|
26
|
-
its(:arguments) {
|
24
|
+
its(:path) { is_expected.to eq('users/details.json') }
|
25
|
+
its(:api) { is_expected.to eq(api) }
|
26
|
+
its(:arguments) { is_expected.to eq({args: true}) }
|
27
27
|
end
|
28
28
|
|
29
|
-
context perform_requests: true do
|
29
|
+
context 'requests', perform_requests: true do
|
30
30
|
let(:request_path) { '/api/3.0/users/details.json' }
|
31
31
|
|
32
32
|
its(:details) { should be_a(Hash) }
|
33
33
|
its(:details) { should be_a(::DisqusApi::Response) }
|
34
34
|
|
35
35
|
it 'performs requests' do
|
36
|
-
namespace.details['code'].
|
36
|
+
expect(namespace.details['code']).to eq(0)
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "#request_action" do
|
40
40
|
let(:response) { namespace.request_action('details') }
|
41
41
|
|
42
42
|
it 'performs action request' do
|
43
|
-
response['code'].
|
43
|
+
expect(response['code']).to eq(0)
|
44
44
|
end
|
45
45
|
|
46
46
|
context "invalid request" do
|
@@ -50,4 +50,4 @@ describe DisqusApi::Namespace do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
|
-
end
|
53
|
+
end
|
@@ -33,13 +33,13 @@ describe DisqusApi::Request do
|
|
33
33
|
|
34
34
|
describe "#perform" do
|
35
35
|
it 'sends request through API' do
|
36
|
-
request.perform['code'].
|
36
|
+
expect(request.perform['code']).to eq(0)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe ".perform" do
|
41
41
|
it 'sends request through API' do
|
42
|
-
described_class.perform(api, namespace, action, arguments)['code'].
|
42
|
+
expect(described_class.perform(api, namespace, action, arguments)['code']).to eq(0)
|
43
43
|
end
|
44
44
|
end
|
45
|
-
end
|
45
|
+
end
|
@@ -14,30 +14,30 @@ describe DisqusApi::Response do
|
|
14
14
|
let(:response_body) { {} }
|
15
15
|
|
16
16
|
before do
|
17
|
-
request.
|
17
|
+
expect(request).to receive(:perform).with(arguments).and_return(response_body)
|
18
18
|
end
|
19
19
|
|
20
20
|
describe "#has_next?" do
|
21
21
|
context "has" do
|
22
22
|
let(:response_body) { {'cursor' => {'hasNext' => true}} }
|
23
|
-
its(:has_next?) {
|
23
|
+
its(:has_next?) { is_expected.to be true }
|
24
24
|
end
|
25
25
|
|
26
26
|
context 'has not' do
|
27
27
|
let(:response_body) { {'cursor' => {'hasNext' => false}} }
|
28
|
-
its(:has_next?) {
|
28
|
+
its(:has_next?) { is_expected.to be false }
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#has_prev?" do
|
33
33
|
context "has" do
|
34
34
|
let(:response_body) { {'cursor' => {'hasPrev' => true}} }
|
35
|
-
its(:has_prev?) {
|
35
|
+
its(:has_prev?) { is_expected.to be true }
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'has not' do
|
39
39
|
let(:response_body) { {'cursor' => {'hasPrev' => false}} }
|
40
|
-
its(:has_prev?) {
|
40
|
+
its(:has_prev?) { is_expected.to be false }
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -67,7 +67,7 @@ describe DisqusApi::Response do
|
|
67
67
|
let(:next_page_response) { double('next_page_response') }
|
68
68
|
|
69
69
|
before do
|
70
|
-
request.
|
70
|
+
expect(request).to receive(:response).with({limit: 1, cursor: 'another_page'}).and_return(next_page_response)
|
71
71
|
end
|
72
72
|
|
73
73
|
its(:next) { should == next_page_response }
|
@@ -79,13 +79,13 @@ describe DisqusApi::Response do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe "#
|
82
|
+
describe "#prev" do
|
83
83
|
context "has previous page" do
|
84
84
|
let(:response_body) { {'cursor' => {'hasPrev' => true, 'prev' => 'another_page'}} }
|
85
85
|
let(:prev_page_response) { double('prev_page_response') }
|
86
86
|
|
87
87
|
before do
|
88
|
-
request.
|
88
|
+
expect(request).to receive(:response).with({limit: 1, cursor: 'another_page'}).and_return(prev_page_response)
|
89
89
|
end
|
90
90
|
|
91
91
|
its(:prev) { should == prev_page_response }
|
@@ -102,26 +102,23 @@ describe DisqusApi::Response do
|
|
102
102
|
|
103
103
|
context "building a enumerator" do
|
104
104
|
before do
|
105
|
-
request.
|
106
|
-
request.
|
105
|
+
expect(request).not_to receive(:prev)
|
106
|
+
expect(request).not_to receive(:next)
|
107
|
+
expect(request).not_to receive(:perform)
|
107
108
|
end
|
108
109
|
|
109
110
|
describe "#each_page" do
|
110
|
-
|
111
|
-
subject.each_page
|
112
|
-
end
|
111
|
+
specify { subject.each_page }
|
113
112
|
end
|
114
113
|
|
115
114
|
describe "#each_resource" do
|
116
|
-
|
117
|
-
subject.each_resource
|
118
|
-
end
|
115
|
+
specify { subject.each_resource }
|
119
116
|
end
|
120
117
|
end
|
121
118
|
|
122
119
|
context "multiple pages" do
|
123
120
|
before do
|
124
|
-
request.
|
121
|
+
expect(request).to receive(:perform).with(arguments.merge(cursor: 'another_page')).and_return(another_page_response_body)
|
125
122
|
end
|
126
123
|
|
127
124
|
let(:page_1_elem_1) { double('page_1_elem_1') }
|
@@ -137,17 +134,17 @@ describe DisqusApi::Response do
|
|
137
134
|
|
138
135
|
describe "#next!" do
|
139
136
|
before { response.next! }
|
140
|
-
it {
|
137
|
+
it { is_expected.to be_a(described_class) }
|
141
138
|
|
142
139
|
it 'steps on next page' do
|
143
|
-
response['page'].
|
140
|
+
expect(response['page']).to eq(2)
|
144
141
|
end
|
145
142
|
|
146
143
|
context "no next" do
|
147
144
|
before { response.next! }
|
148
145
|
|
149
146
|
it 'does nothing' do
|
150
|
-
response['page'].
|
147
|
+
expect(response['page']).to eq(2)
|
151
148
|
end
|
152
149
|
end
|
153
150
|
end
|
@@ -161,29 +158,29 @@ describe DisqusApi::Response do
|
|
161
158
|
}
|
162
159
|
|
163
160
|
before { response.prev! }
|
164
|
-
it {
|
161
|
+
it { is_expected.to be_a(described_class) }
|
165
162
|
|
166
163
|
it 'steps on previous page' do
|
167
|
-
response['page'].
|
164
|
+
expect(response['page']).to eq(1)
|
168
165
|
end
|
169
166
|
|
170
167
|
context "no previous" do
|
171
168
|
before { response.prev! }
|
172
169
|
|
173
170
|
it 'does nothing' do
|
174
|
-
response['page'].
|
171
|
+
expect(response['page']).to eq(1)
|
175
172
|
end
|
176
173
|
end
|
177
174
|
end
|
178
175
|
|
179
176
|
describe "#each_page" do
|
180
177
|
it 'returns each page' do
|
181
|
-
subject.each_page.to_a.
|
178
|
+
expect(subject.each_page.to_a).to eq([[page_1_elem_1], [page_2_elem_1]])
|
182
179
|
end
|
183
180
|
|
184
181
|
it 'iterates through each page' do
|
185
|
-
page_1_elem_1.
|
186
|
-
page_2_elem_1.
|
182
|
+
expect(page_1_elem_1).to receive(:get_block_message)
|
183
|
+
expect(page_2_elem_1).to receive(:get_block_message)
|
187
184
|
|
188
185
|
subject.each_page { |page| page.each(&:get_block_message) }
|
189
186
|
end
|
@@ -191,16 +188,16 @@ describe DisqusApi::Response do
|
|
191
188
|
|
192
189
|
describe "#each_resource" do
|
193
190
|
it 'returns each record iterator' do
|
194
|
-
subject.each_resource.to_a.
|
191
|
+
expect(subject.each_resource.to_a).to eq([page_1_elem_1, page_2_elem_1])
|
195
192
|
end
|
196
193
|
|
197
194
|
it 'iterates through each resource' do
|
198
|
-
page_1_elem_1.
|
199
|
-
page_2_elem_1.
|
195
|
+
expect(page_1_elem_1).to receive(:get_block_message)
|
196
|
+
expect(page_2_elem_1).to receive(:get_block_message)
|
200
197
|
|
201
198
|
subject.each_resource(&:get_block_message)
|
202
199
|
end
|
203
200
|
end
|
204
201
|
end
|
205
202
|
end
|
206
|
-
end
|
203
|
+
end
|
data/spec/disqus_api_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe DisqusApi, perform_requests: true do
|
|
5
5
|
let(:request_path) { '/api/3.0/users/details.json' }
|
6
6
|
|
7
7
|
it 'performs requests' do
|
8
|
-
DisqusApi.v3.users.details['code'].
|
8
|
+
expect(DisqusApi.v3.users.details['code']).to eq(0)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -18,7 +18,7 @@ describe DisqusApi, perform_requests: true do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'fetches all comments' do
|
21
|
-
DisqusApi.v3.posts.list(forum: 'my_forum', limit: 1).all.
|
21
|
+
expect(DisqusApi.v3.posts.list(forum: 'my_forum', limit: 1).all).to eq(%w{first_one second_one third_one})
|
22
22
|
end
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'disqus_api'
|
2
|
+
require 'rspec/its'
|
2
3
|
|
3
4
|
def load_disqus_config(fname)
|
4
5
|
DisqusApi.config = YAML.load_file(File.join(File.dirname(__FILE__), "config/#{fname}"))
|
@@ -33,7 +34,7 @@ end
|
|
33
34
|
|
34
35
|
RSpec.configure do |config|
|
35
36
|
config.mock_with :rspec
|
36
|
-
config.
|
37
|
+
config.color = true
|
37
38
|
config.formatter = :documentation
|
38
39
|
|
39
40
|
if ENV['USE_DISQUS_ACCOUNT']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disqus_api
|
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
|
- Sergei Zinin (einzige)
|
@@ -14,56 +14,96 @@ dependencies:
|
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '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
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.9'
|
34
|
+
- - "<"
|
32
35
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
36
|
+
version: '2.0'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- -
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
43
|
+
version: '0.9'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: faraday_middleware
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
53
|
+
version: '0.10'
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '2.0'
|
48
57
|
type: :runtime
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- -
|
61
|
+
- - ">="
|
53
62
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
63
|
+
version: '0.10'
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '2.0'
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: rspec
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
59
|
-
- -
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rspec-its
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rake
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
60
100
|
- !ruby/object:Gem::Version
|
61
101
|
version: '0'
|
62
102
|
type: :development
|
63
103
|
prerelease: false
|
64
104
|
version_requirements: !ruby/object:Gem::Requirement
|
65
105
|
requirements:
|
66
|
-
- -
|
106
|
+
- - ">="
|
67
107
|
- !ruby/object:Gem::Version
|
68
108
|
version: '0'
|
69
109
|
description: Provides clean Disqus API for your Ruby app with a nice interface.
|
@@ -73,10 +113,11 @@ extensions: []
|
|
73
113
|
extra_rdoc_files:
|
74
114
|
- README.md
|
75
115
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .travis.yml
|
116
|
+
- ".gitignore"
|
117
|
+
- ".travis.yml"
|
78
118
|
- Gemfile
|
79
119
|
- Guardfile
|
120
|
+
- LICENSE.txt
|
80
121
|
- README.md
|
81
122
|
- Rakefile
|
82
123
|
- disqus_api.gemspec
|
@@ -85,8 +126,10 @@ files:
|
|
85
126
|
- lib/disqus_api/api.rb
|
86
127
|
- lib/disqus_api/invalid_api_request_error.rb
|
87
128
|
- lib/disqus_api/namespace.rb
|
129
|
+
- lib/disqus_api/railtie.rb
|
88
130
|
- lib/disqus_api/request.rb
|
89
131
|
- lib/disqus_api/response.rb
|
132
|
+
- lib/version.rb
|
90
133
|
- spec/config/disqus.yml.example
|
91
134
|
- spec/disqus_api/api_spec.rb
|
92
135
|
- spec/disqus_api/namespace_spec.rb
|
@@ -104,17 +147,16 @@ require_paths:
|
|
104
147
|
- lib
|
105
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
106
149
|
requirements:
|
107
|
-
- -
|
150
|
+
- - ">="
|
108
151
|
- !ruby/object:Gem::Version
|
109
152
|
version: '0'
|
110
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
154
|
requirements:
|
112
|
-
- -
|
155
|
+
- - ">="
|
113
156
|
- !ruby/object:Gem::Version
|
114
157
|
version: '0'
|
115
158
|
requirements: []
|
116
|
-
|
117
|
-
rubygems_version: 2.1.5
|
159
|
+
rubygems_version: 3.0.3
|
118
160
|
signing_key:
|
119
161
|
specification_version: 4
|
120
162
|
summary: Disqus API for Ruby
|