newsblurry 0.0.1 → 1.0.0
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +12 -1
- data/lib/newsblurry.rb +2 -1
- data/lib/newsblurry/agent.rb +16 -0
- data/lib/newsblurry/version.rb +1 -1
- data/newsblurry.gemspec +1 -1
- data/spec/newsblurry/agent_spec.rb +41 -0
- data/spec/newsblurry/connection_spec.rb +1 -1
- data/spec/newsblurry/version_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caff377bf664d7cbee0a5dce658aac7caa1d9953
|
4
|
+
data.tar.gz: 386323e5f38e7491dcee6dbabcc88917ef385e8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe4c707b18da67891cb3f4308a2e4bebb192f9e33d9d9d4430f86a6e591f975afc9f8c561fe06d35b3b89b0625cafc13ad659bcf6708acb3f866f631b4bc1815
|
7
|
+
data.tar.gz: a18885f67ccb7837a7b80ec8651633f08b17d8903f8610efcc5d23bc9147ef399bc24ab222c362960ece40c7f9b29f9f0a92128d36905844619921825f1f8071
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
## Description
|
9
9
|
|
10
|
-
Connect to Newsblur
|
10
|
+
Connect to Newsblur API using Ruby
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
Add this line to your Gemfile
|
@@ -20,5 +20,16 @@ And then:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
+
Create a new agent with your username and password.
|
24
|
+
Use the agent to retrieve your unread stories or mark a story as read.
|
25
|
+
|
26
|
+
agent = Newsblurry::Agent(username, password)
|
27
|
+
|
28
|
+
### Return all unread stories for account
|
29
|
+
unread_stories = agent.unread_stories
|
30
|
+
|
31
|
+
### Mark a story as read
|
32
|
+
agent.mark_as_read(newsblurry_story_hash)
|
33
|
+
|
23
34
|
## License
|
24
35
|
Released under the MIT License
|
data/lib/newsblurry.rb
CHANGED
@@ -2,9 +2,10 @@ require 'httparty'
|
|
2
2
|
require 'newsblurry/version'
|
3
3
|
|
4
4
|
module Newsblurry
|
5
|
+
autoload :Agent, 'newsblurry/agent'
|
5
6
|
autoload :Connection, 'newsblurry/connection'
|
6
7
|
autoload :Feed, 'newsblurry/feed'
|
7
|
-
autoload :Story, 'newsblurry/story'
|
8
8
|
autoload :FeedParser, 'newsblurry/feed_parser'
|
9
|
+
autoload :Story, 'newsblurry/story'
|
9
10
|
autoload :StoryParser, 'newsblurry/story_parser'
|
10
11
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Newsblurry
|
2
|
+
class Agent
|
3
|
+
|
4
|
+
def initialize(username, password)
|
5
|
+
@connection = Newsblurry::Connection.new(username, password)
|
6
|
+
end
|
7
|
+
|
8
|
+
def unread_stories
|
9
|
+
@connection.unread_stories
|
10
|
+
end
|
11
|
+
|
12
|
+
def mark_as_read(story_hash)
|
13
|
+
@connection.mark_as_read(story_hash)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/newsblurry/version.rb
CHANGED
data/newsblurry.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.email = 'jgeiger@gmail.com'
|
12
12
|
s.homepage = 'http://github.com/jgeiger/newsblurry'
|
13
13
|
|
14
|
-
s.summary = 'Newsblurry is a Ruby client
|
14
|
+
s.summary = 'Newsblurry is a Ruby client for the Newsblur API.'
|
15
15
|
s.description = 'Access your Newsblur feed using Ruby.'
|
16
16
|
s.licenses = ["MIT"]
|
17
17
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Newsblurry::Agent do
|
4
|
+
before do
|
5
|
+
username = 'test'
|
6
|
+
password = 'test'
|
7
|
+
@connection = double(:connection)
|
8
|
+
|
9
|
+
expect(Newsblurry::Connection).to receive(:new)
|
10
|
+
.and_return(@connection)
|
11
|
+
|
12
|
+
@agent = Newsblurry::Agent.new(username, password)
|
13
|
+
end
|
14
|
+
|
15
|
+
context '#initialize' do
|
16
|
+
it 'creates a Newsblurry::Agent instance' do
|
17
|
+
expect(@agent.class).to eq(Newsblurry::Agent)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when accessing the API' do
|
22
|
+
context '#unread_stories' do
|
23
|
+
it 'calls the connection method for unread_stories' do
|
24
|
+
expect(@connection).to receive(:unread_stories)
|
25
|
+
|
26
|
+
@agent.unread_stories
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context '#mark_as_read' do
|
31
|
+
it 'calls the connection method for mark_as_read' do
|
32
|
+
story_hash = '1234:abcd'
|
33
|
+
|
34
|
+
expect(@connection).to receive(:mark_as_read)
|
35
|
+
.with(story_hash)
|
36
|
+
|
37
|
+
@agent.mark_as_read(story_hash)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newsblurry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joey Geiger
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- README.md
|
66
66
|
- Rakefile
|
67
67
|
- lib/newsblurry.rb
|
68
|
+
- lib/newsblurry/agent.rb
|
68
69
|
- lib/newsblurry/connection.rb
|
69
70
|
- lib/newsblurry/feed.rb
|
70
71
|
- lib/newsblurry/feed_parser.rb
|
@@ -76,6 +77,7 @@ files:
|
|
76
77
|
- spec/fixtures/feeds.txt
|
77
78
|
- spec/fixtures/mark_as_read_1095_cdeec3.txt
|
78
79
|
- spec/fixtures/unread_feed_story_hashes.txt
|
80
|
+
- spec/newsblurry/agent_spec.rb
|
79
81
|
- spec/newsblurry/connection_spec.rb
|
80
82
|
- spec/newsblurry/feed_parser_spec.rb
|
81
83
|
- spec/newsblurry/feed_spec.rb
|
@@ -106,5 +108,5 @@ rubyforge_project:
|
|
106
108
|
rubygems_version: 2.0.3
|
107
109
|
signing_key:
|
108
110
|
specification_version: 4
|
109
|
-
summary: Newsblurry is a Ruby client
|
111
|
+
summary: Newsblurry is a Ruby client for the Newsblur API.
|
110
112
|
test_files: []
|