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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f2046f72b33788e1164f9dc67f29dd6ed621fe0
4
- data.tar.gz: 58dd9af17bf01649f2cabc6e64157298337dcc0f
3
+ metadata.gz: caff377bf664d7cbee0a5dce658aac7caa1d9953
4
+ data.tar.gz: 386323e5f38e7491dcee6dbabcc88917ef385e8c
5
5
  SHA512:
6
- metadata.gz: a2543e9a04d8bbe80c4e0e2062f0c340a16f74a880d6fda27842876e63aaf8cb61349156f23ab6c4182b924d73e220f07620f1ee77ea5abaaffdf954405a37a5
7
- data.tar.gz: 8b8f3b6c35e9f8f0378cb71a355e32f253c9e534d9a64b79be13a2c391c894cc66381c6345b8bc5f4de74c079d8bf2426ee01f59621b5af8a1a62f319f6744a5
6
+ metadata.gz: fe4c707b18da67891cb3f4308a2e4bebb192f9e33d9d9d4430f86a6e591f975afc9f8c561fe06d35b3b89b0625cafc13ad659bcf6708acb3f866f631b4bc1815
7
+ data.tar.gz: a18885f67ccb7837a7b80ec8651633f08b17d8903f8610efcc5d23bc9147ef399bc24ab222c362960ece40c7f9b29f9f0a92128d36905844619921825f1f8071
@@ -1,2 +1,5 @@
1
+ ## 1.0.0, released 2013-10-11
2
+ * Use Newsblurry::Agent to retrieve unread stories
3
+
1
4
  ## 0.0.1, released 2013-10-06
2
5
  * Initial release
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Newsblurry
2
- VERSION = '0.0.1'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -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 to access the Newsblur API.'
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
@@ -11,7 +11,7 @@ describe Newsblurry::Connection do
11
11
  body: 'password=test&username=test',
12
12
  headers: {
13
13
  'Cookie' => '',
14
- 'User-Agent' => 'Newsblurry::Connection - 0.0.1'
14
+ 'User-Agent' => "Newsblurry::Connection - #{Newsblurry::VERSION}",
15
15
  }
16
16
  )
17
17
 
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Newsblurry do
4
4
  it 'returns the version' do
5
- expect(Newsblurry::VERSION).to eq('0.0.1')
5
+ expect(Newsblurry::VERSION).to eq('1.0.0')
6
6
  end
7
7
  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.1
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 to access the Newsblur API.
111
+ summary: Newsblurry is a Ruby client for the Newsblur API.
110
112
  test_files: []