kinja 0.0.8 → 0.0.9

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.
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kinja::Post do
4
+ let(:kinja) {
5
+ Kinja::Client.new(
6
+ user: ENV["USER"],
7
+ password: ENV["PASS"]
8
+ )
9
+ }
10
+
11
+ let(:response) {
12
+ VCR.use_cassette('login') do
13
+ kinja.login
14
+ end
15
+ }
16
+
17
+ it "retrieves individual posts" do
18
+ VCR.use_cassette('get_post') do
19
+ post = kinja.get_post("1691726561")
20
+ expect(post["data"]["headline"][0...-1]).to eq "Is This Australian TV Anchor Wearing a Dick Or What?"
21
+ end
22
+
23
+ VCR.use_cassette('get_post') do
24
+ post = kinja.get_post("http://gawker.com/is-this-australian-tv-anchor-wearing-a-dick-or-what-1691726561")
25
+ expect(post["data"]["headline"][0...-1]).to eq "Is This Australian TV Anchor Wearing a Dick Or What?"
26
+ end
27
+ end
28
+
29
+ it "posts stuff" do
30
+ VCR.use_cassette('write-post') do
31
+ post = kinja.create_post(
32
+ headline: '',
33
+ body: '<p>[<a data-attr="http://gawker.com/no-playlist-1685415865" href="http://gawker.com/no-playlist-1685415865">Gawker</a>]</p>',
34
+ status: 'PUBLISHED',
35
+ replies: false
36
+ )
37
+ expect(post.code).to be 200
38
+ end
39
+ end
40
+
41
+ it "updates posts" do
42
+ VCR.use_cassette('update-post') do
43
+ link = "http://gemtest.kinja.com/gawker-1687581385"
44
+ post = kinja.update_post(link, publishTimeMillis: DateTime.now.strftime('%Q').to_i)
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kinja::Blog do
4
+ let(:kinja) {
5
+ Kinja::Client.new
6
+ }
7
+
8
+ it "retrieves posts by blog and tag name" do
9
+ VCR.use_cassette('get_tag_by_blog_id') do
10
+ feed = kinja.tag("game of thrones", 7)
11
+ expect(feed[0]["post"]["headline"].include? "A Closer Look").to be true
12
+ end
13
+
14
+ VCR.use_cassette('get_tag_by_blog_name') do
15
+ feed = kinja.tag("game of thrones", "gawker.com")
16
+ expect(feed[0]["post"]["headline"].include? "A Closer Look").to be true
17
+ end
18
+ end
19
+
20
+ it "retrieves posts across kinja by tag name" do
21
+ VCR.use_cassette('get_tag') do
22
+ feed = kinja.tag("game of thrones")
23
+ expect(feed[0]["post"]["headline"].include? "HBO Now Review").to be true
24
+ end
25
+ end
26
+
27
+ end
@@ -1,19 +1,8 @@
1
- require_relative '../../lib/kinja'
2
-
3
- require 'vcr'
4
- VCR.configure do |config|
5
- config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
6
- config.hook_into :webmock # or :fakeweb
7
- config.allow_http_connections_when_no_cassette = true
8
- end
9
-
10
- require 'dotenv'
11
- ENV = Dotenv.load
1
+ require 'spec_helper'
12
2
 
13
3
  describe Kinja do
14
-
15
4
  let(:kinja) {
16
- Kinja::Client.new(
5
+ Kinja.new(
17
6
  user: ENV["USER"],
18
7
  password: ENV["PASS"]
19
8
  )
@@ -21,7 +10,7 @@ describe Kinja do
21
10
 
22
11
  let(:response) {
23
12
  VCR.use_cassette('login') do
24
- kinja.login
13
+ kinja.login
25
14
  end
26
15
  }
27
16
 
@@ -39,66 +28,4 @@ describe Kinja do
39
28
  end
40
29
  end
41
30
 
42
- it "gets the author profile" do
43
- VCR.use_cassette('author-path-er') do
44
- blog_id = kinja.get_author(response["data"])["data"][0]["defaultBlogId"]
45
- expect(blog_id).to eq 1634457255
46
- end
47
- end
48
-
49
- it "gets the default blog id" do
50
- VCR.use_cassette('author-path-er') do
51
- blog_id = kinja.get_default_blog_id(response["data"])
52
- expect(blog_id).to eq 1634457255
53
- end
54
- end
55
-
56
- it "posts stuff" do
57
- VCR.use_cassette('write-post') do
58
- post = kinja.create_post(
59
- headline: '',
60
- body: '<p>[<a data-attr="http://gawker.com/no-playlist-1685415865" href="http://gawker.com/no-playlist-1685415865">Gawker</a>]</p>',
61
- status: 'PUBLISHED',
62
- replies: false
63
- )
64
- expect(post.code).to be 200
65
- end
66
- end
67
-
68
- it "updates posts" do
69
- VCR.use_cassette('update-post') do
70
- link = "http://gemtest.kinja.com/gawker-1687581385"
71
- post = kinja.update_post(link, publishTimeMillis: DateTime.now.strftime('%Q').to_i)
72
- end
73
- end
74
-
75
- it "retrieves posts" do
76
- VCR.use_cassette('get_post') do
77
- post = kinja.get_post("1691726561")
78
- expect(post["data"]["headline"][0...-1]).to eq "Is This Australian TV Anchor Wearing a Dick Or What?"
79
- end
80
-
81
- VCR.use_cassette('get_post') do
82
- post = kinja.get_post("http://gawker.com/is-this-australian-tv-anchor-wearing-a-dick-or-what-1691726561")
83
- expect(post["data"]["headline"][0...-1]).to eq "Is This Australian TV Anchor Wearing a Dick Or What?"
84
- end
85
- end
86
-
87
- it "gets an id from a link" do
88
- new_link = "http://gizmodo.com/how-police-body-cameras-were-designed-to-get-cops-off-t-1691693677/+maxread"
89
- expect(kinja.get_post_id new_link).to eq "1691693677"
90
-
91
- old_link = "http://lifehacker.com/238306/lifehacker-code-texter-windows"
92
- expect(kinja.get_post_id old_link).to eq "238306"
93
-
94
- old_link_nums = "http://lifehacker.com/238306/lifehacker-21-code-texter-windows"
95
- expect(kinja.get_post_id old_link_nums).to eq "238306"
96
-
97
- multi_nums = "http://theconcourse.deadspin.com/a-21st-century-rip-van-winkle-what-changed-in-my-decad-1691783386/+laceydonohue"
98
- expect(kinja.get_post_id multi_nums).to eq "1691783386"
99
- end
100
-
101
- it "returns the id if it's passed an id instead of a link" do
102
- expect(kinja.get_post_id "23432343").to eq "23432343"
103
- end
104
31
  end
@@ -0,0 +1,16 @@
1
+ RSpec.configure do |c|
2
+ # filter_run is short-form alias for filter_run_including
3
+ # c.filter_run :focus => true
4
+ end
5
+
6
+ require 'dotenv'
7
+ ENV = Dotenv.load
8
+
9
+ require 'vcr'
10
+ VCR.configure do |config|
11
+ config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
12
+ config.hook_into :webmock # or :fakeweb
13
+ config.allow_http_connections_when_no_cassette = true
14
+ end
15
+
16
+ require_relative '../lib/kinja'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kinja
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Pash
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-20 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -152,14 +152,35 @@ files:
152
152
  - Rakefile
153
153
  - kinja.gemspec
154
154
  - lib/kinja.rb
155
+ - lib/kinja/author.rb
156
+ - lib/kinja/blog.rb
157
+ - lib/kinja/client.rb
158
+ - lib/kinja/helpers.rb
159
+ - lib/kinja/post.rb
160
+ - lib/kinja/tag.rb
155
161
  - lib/kinja/version.rb
156
162
  - spec/fixtures/vcr_cassettes/api-token-test.yml
157
163
  - spec/fixtures/vcr_cassettes/author-path-er.yml
164
+ - spec/fixtures/vcr_cassettes/get_author_default_blog_id.yml
165
+ - spec/fixtures/vcr_cassettes/get_author_profile.yml
166
+ - spec/fixtures/vcr_cassettes/get_blog_id.yml
167
+ - spec/fixtures/vcr_cassettes/get_feed_by_id.yml
168
+ - spec/fixtures/vcr_cassettes/get_feed_by_name.yml
158
169
  - spec/fixtures/vcr_cassettes/get_post.yml
170
+ - spec/fixtures/vcr_cassettes/get_tag.yml
171
+ - spec/fixtures/vcr_cassettes/get_tag_by_blog_id.yml
172
+ - spec/fixtures/vcr_cassettes/get_tag_by_blog_name.yml
159
173
  - spec/fixtures/vcr_cassettes/login.yml
160
174
  - spec/fixtures/vcr_cassettes/update-post.yml
161
175
  - spec/fixtures/vcr_cassettes/write-post.yml
176
+ - spec/lib/kinja/author_spec.rb
177
+ - spec/lib/kinja/blog_spec.rb
178
+ - spec/lib/kinja/client_spec.rb
179
+ - spec/lib/kinja/helpers_spec.rb
180
+ - spec/lib/kinja/post_spec.rb
181
+ - spec/lib/kinja/tag_spec.rb
162
182
  - spec/lib/kinja_spec.rb
183
+ - spec/spec_helper.rb
163
184
  homepage: ''
164
185
  licenses:
165
186
  - MIT
@@ -187,8 +208,23 @@ summary: Simple gem for creating posts on Kinja
187
208
  test_files:
188
209
  - spec/fixtures/vcr_cassettes/api-token-test.yml
189
210
  - spec/fixtures/vcr_cassettes/author-path-er.yml
211
+ - spec/fixtures/vcr_cassettes/get_author_default_blog_id.yml
212
+ - spec/fixtures/vcr_cassettes/get_author_profile.yml
213
+ - spec/fixtures/vcr_cassettes/get_blog_id.yml
214
+ - spec/fixtures/vcr_cassettes/get_feed_by_id.yml
215
+ - spec/fixtures/vcr_cassettes/get_feed_by_name.yml
190
216
  - spec/fixtures/vcr_cassettes/get_post.yml
217
+ - spec/fixtures/vcr_cassettes/get_tag.yml
218
+ - spec/fixtures/vcr_cassettes/get_tag_by_blog_id.yml
219
+ - spec/fixtures/vcr_cassettes/get_tag_by_blog_name.yml
191
220
  - spec/fixtures/vcr_cassettes/login.yml
192
221
  - spec/fixtures/vcr_cassettes/update-post.yml
193
222
  - spec/fixtures/vcr_cassettes/write-post.yml
223
+ - spec/lib/kinja/author_spec.rb
224
+ - spec/lib/kinja/blog_spec.rb
225
+ - spec/lib/kinja/client_spec.rb
226
+ - spec/lib/kinja/helpers_spec.rb
227
+ - spec/lib/kinja/post_spec.rb
228
+ - spec/lib/kinja/tag_spec.rb
194
229
  - spec/lib/kinja_spec.rb
230
+ - spec/spec_helper.rb