feedly_api 0.3b

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: aa7b9a5e1ff711b239e67177e6ba857d219bbda6
4
+ data.tar.gz: 0428afa39ef088f27ad2f2f9f68d6414a80c21b7
5
+ SHA512:
6
+ metadata.gz: cd76d9b7bee053885031f4c5a480b2e6b6e1bffa53af50676152f4c1def64448aaa405910c5d07be7d4d5f7f4a930f1825839a283b6db668edb79152f96dccf6
7
+ data.tar.gz: 2c3be7a251a7b9519079463554570971ae88e952b23bf185eaf927f896e9dee651280a5b7bc6a16bf754902d6d80745af1824b16f11c84b649e4d616bb57fe52
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format=documentation
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org/'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2013 Myuzu
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ feedly_api
2
+ ==========
3
+
4
+ Early unofficial Feedly API
5
+
6
+ ## Usage
7
+
8
+ ```ruby
9
+ feedly = FeedlyApi::Client.new
10
+ => #<FeedlyApi::Client:0xb91fed0c @auth_token=nil>
11
+ feed = feedly.feed 'https://www.eff.org/rss/updates.xml'
12
+ => #<FeedlyApi::Feed:0xb90aef38
13
+ @subscribers=2348,
14
+ @title="Deeplinks",
15
+ @url="https://www.eff.org/rss/updates.xml",
16
+ @velocity=15.2>
17
+ feed.items
18
+ => [{:id=>
19
+ "55jQyVFBayOwBJQ5qCX8DsgTPumTnzjw6LozTAKPiWA=_13fa6b1134b:1a10f:eacbe387",
20
+ :originId=>"74790 at https://www.eff.org",
21
+ :fingerprint=>"2a5c0169",
22
+ :title=>"Weev's Case Flawed From Beginning to End",
23
+ :published=>1372888846000,
24
+ # ...
25
+ feed.items(ranked: 'oldest')
26
+ => [{:id=>
27
+ "55jQyVFBayOwBJQ5qCX8DsgTPumTnzjw6LozTAKPiWA=_13f12b61e62:1a2a50:4b1c86ed",
28
+ :originId=>"74409 at https://www.eff.org",
29
+ :fingerprint=>"20f13975",
30
+ :title=>
31
+ "Taiwanese Users Thwart Government Plans to Introduce Internet
32
+ Blacklist Law",
33
+ :published=>1370282860000,
34
+ # ...
35
+ feed.items.length
36
+ => 20
37
+ feed.items(count: 50, ranked: 'oldest').length
38
+ => 50
39
+ ```
40
+
41
+ List of params you can pass to `items` method:
42
+ * `ranked`: 'oldest', 'newest'
43
+ * `count`: integer, number of feed items to return (1..1000)
44
+ * `continuation`: string
45
+ * maybe some other params...
46
+
47
+ ## License
48
+
49
+ Apache License, Version 2.0
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new do |t|
6
+ t.rspec_opts = '--color --format doc'
7
+ end
8
+
9
+ task default: :spec
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ $: << File.expand_path('../lib', __FILE__)
3
+ require 'feedly_api'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'feedly_api'
7
+ s.version = FeedlyApi::VERSION
8
+ s.authors = ['Myuzu']
9
+ s.homepage = 'https://github.com/Myuzu/feedly_api'
10
+ s.summary = %q{Ruby wrapper for Feedly API}
11
+ s.description = %q{Simpe unofficial Feedly API wrapper. No auth yet.}
12
+ s.license = 'Apache version 2'
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.require_paths = ['lib']
16
+
17
+ s.required_ruby_version = '>= 1.9.3'
18
+
19
+ s.add_development_dependency 'rake'
20
+ s.add_development_dependency 'rspec'
21
+ s.add_development_dependency 'pry'
22
+ end
data/lib/feedly_api.rb ADDED
@@ -0,0 +1,63 @@
1
+ # encoding: utf-8
2
+
3
+ module FeedlyApi
4
+ VERSION = '0.3b'
5
+ API_ENDPOINT = 'http://cloud.feedly.com/v3/'
6
+
7
+ class Feed
8
+ attr_reader :url, :subscribers, :title, :velocity
9
+
10
+ def initialize(url)
11
+ @url = url
12
+ get_info
13
+ end
14
+
15
+ def get_info
16
+ url = API_ENDPOINT
17
+ url += 'feeds/feed%2F'
18
+ url += CGI.escape(@url)
19
+ json = JSON.parse(get(url))
20
+
21
+ @subscribers = json['subscribers']
22
+ @title = json['title']
23
+ @velocity = json['velocity']
24
+ end
25
+
26
+ def items(params = {})
27
+ json = JSON.parse(get(construct_url(params)), symbolize_names: true)
28
+ json[:items]
29
+ end
30
+
31
+ private
32
+
33
+ def construct_url(options)
34
+ params = options.map { |k,v| "#{k.to_s}=#{v.to_s}&" }.join
35
+ url = FeedlyApi::API_ENDPOINT
36
+ url += 'streams/feed%2F'
37
+ url += CGI.escape(@url)
38
+ url += '/contents?'
39
+ url += "ck=#{Time.now.to_i}000&"
40
+ url += params
41
+ end
42
+
43
+ def get(url)
44
+ response = Net::HTTP.get_response(URI(url))
45
+ raise unless 200 == response.code.to_i
46
+ response.body
47
+ end
48
+ end
49
+
50
+ class Client
51
+ def initialize(auth_token = nil)
52
+ @auth_token = auth_token
53
+ end
54
+
55
+ def feed(feed_url)
56
+ FeedlyApi::Feed.new feed_url
57
+ end
58
+ end
59
+
60
+ require 'cgi'
61
+ require 'net/http'
62
+ require 'json'
63
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe FeedlyApi do
4
+
5
+ describe '#new' do
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,2 @@
1
+ require 'feedly_api'
2
+ require 'pry'
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: feedly_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3b
5
+ platform: ruby
6
+ authors:
7
+ - Myuzu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Simpe unofficial Feedly API wrapper. No auth yet.
56
+ email:
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - .gitignore
62
+ - .rspec
63
+ - .travis.yml
64
+ - Gemfile
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - feedly_api.gemspec
69
+ - lib/feedly_api.rb
70
+ - spec/lib/feedly_api_spec.rb
71
+ - spec/spec_helper.rb
72
+ homepage: https://github.com/Myuzu/feedly_api
73
+ licenses:
74
+ - Apache version 2
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: 1.9.3
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>'
88
+ - !ruby/object:Gem::Version
89
+ version: 1.3.1
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.0.3
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Ruby wrapper for Feedly API
96
+ test_files: []
97
+ has_rdoc: