disqus_api 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -1
- data/disqus_api.gemspec +1 -1
- data/lib/disqus_api.rb +2 -1
- data/lib/disqus_api/rails.rb +17 -0
- data/spec/disqus_api/response_spec.rb +4 -7
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94064c79aa3d3d6496c03ea346cc067cdd9a3bef
|
4
|
+
data.tar.gz: 4f26931c8cb89148feac62ca8e2a1003ccb505ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 248ac9a87774b6cfcbc2dd7b2266980cbe3cf342a7994acaec1ebc1960a6d94a90d65af947ddc9c75b8015661d0554156d773d75ab6de16e62568644663a75f1
|
7
|
+
data.tar.gz: 8c1cbe082f3dbbf3480e95a9f7b207f001f57d600d026ca9381feb334c2854dce2430465bfcd7e31519668979fe7b3fbae4f9bdd7d801994c751dd462ffeb516
|
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
|
+
```ruby
|
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
|
data/disqus_api.gemspec
CHANGED
data/lib/disqus_api.rb
CHANGED
@@ -11,9 +11,10 @@ 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/rails'
|
14
15
|
|
15
16
|
module DisqusApi
|
16
|
-
VERSION = '0.0.
|
17
|
+
VERSION = '0.0.4'
|
17
18
|
|
18
19
|
def self.adapter
|
19
20
|
@adapter || Faraday.default_adapter
|
@@ -0,0 +1,17 @@
|
|
1
|
+
if defined?(Rails)
|
2
|
+
module DisqusApi
|
3
|
+
class Railtie < Rails::Railtie
|
4
|
+
initializer 'disqus_api.initialize' do
|
5
|
+
config_path = File.join(Rails.root, 'config', "disqus_api.yml")
|
6
|
+
|
7
|
+
if File.exist?(config_path)
|
8
|
+
DisqusApi.config = YAML.load_file(File.join(Rails.root, 'config', "disqus_api.yml"))[Rails.env]
|
9
|
+
else
|
10
|
+
unless Rails.env.test?
|
11
|
+
puts "WARNING: No config/disqus_api.yml provided for Disqus API. Make sure to set configuration manually."
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -79,7 +79,7 @@ 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') }
|
@@ -102,20 +102,17 @@ describe DisqusApi::Response do
|
|
102
102
|
|
103
103
|
context "building a enumerator" do
|
104
104
|
before do
|
105
|
+
request.should_not_receive(:prev)
|
105
106
|
request.should_not_receive(:next)
|
106
107
|
request.should_not_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
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Zinin (einzige)
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/disqus_api/api.rb
|
86
86
|
- lib/disqus_api/invalid_api_request_error.rb
|
87
87
|
- lib/disqus_api/namespace.rb
|
88
|
+
- lib/disqus_api/rails.rb
|
88
89
|
- lib/disqus_api/request.rb
|
89
90
|
- lib/disqus_api/response.rb
|
90
91
|
- spec/config/disqus.yml.example
|