hackernews_ruby 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7a6ce6c4ed75ca0e664a8e2b61d7611bf9032f4
4
- data.tar.gz: 46426e649c903e0db544d803c5c9cc9f8b41432c
3
+ metadata.gz: abfadbf0853d14626548bd2be4a1ca902d15f6c0
4
+ data.tar.gz: 31d448b6b905de2acdb38e4da7f29874a7b792b1
5
5
  SHA512:
6
- metadata.gz: 44b3901881c8e62efe709f7f43eaaa6a56c66a1d25495844402c946a65067c6eb2f9e238f64d8f08cd0e010533668e89f8d6b11dfe7901cbf2833980f1e8a200
7
- data.tar.gz: ba7e5f702cdb3a4f18e72cd3050589571f5a6e5d2e1f822d137a7f456efce35c0d719413984cdc7da45629a69665d17d996211dd4ff0127a2377751207700c56
6
+ metadata.gz: 52e97a81d1eab0e55f1213700f936a2ddeee18c656c00c57aedeb22e829b3be9c08b89855e0d3b194309f4b38a7d1c885add78c173242ec3dd867b1569275b50
7
+ data.tar.gz: 32bf17057d4deb5a68898a680580bb82c3a14667dc1f73664761705415574ba4efe65552d58b8fba33c355c5be12f0b1c2e46e040d473db439dbe1f5b0bd92cf
data/README.md CHANGED
@@ -50,7 +50,7 @@ score | The story's score, or the votes for a pollopt.
50
50
  title | The title of the story or poll.
51
51
  parts | A list of related pollopts, in display order.
52
52
 
53
- To get an item simply do:
53
+ To get an **item** simply do:
54
54
 
55
55
  ```ruby
56
56
  client.get_item(834129)
@@ -101,9 +101,10 @@ This will return an array of ID's. To get each story after that, just use the g
101
101
  ```ruby
102
102
  stories = client.top_stories
103
103
  stories.each do |story|
104
- puts story.title
105
- puts story.score
106
- puts story.url
104
+ resp = client.get_item(story)
105
+ puts resp.title
106
+ puts resp.score
107
+ puts resp.url
107
108
  end
108
109
  ```
109
110
 
@@ -10,8 +10,10 @@ module HackernewsRuby
10
10
 
11
11
 
12
12
  def initialize(options={})
13
- @api_url = options[:api_url].nil? ? HackernewsRuby.api_url : options[:api_url]
14
- @api_version = options[:api_version].nil? ? HackernewsRuby.api_version : options[:api_version]
13
+ @api_url = "https://hacker-news.firebaseio.com"
14
+ @api_version = "v0"
15
+ @api_url = options[:api_url].nil? ? api_url : options[:api_url]
16
+ @api_version = options[:api_version].nil? ? @api_version : options[:api_version]
15
17
 
16
18
  reload_config
17
19
  end
@@ -55,8 +57,8 @@ module HackernewsRuby
55
57
  end
56
58
 
57
59
  def reload_config
58
- HackernewsRuby.api_url = api_url
59
- HackernewsRuby.api_version = api_version
60
+ HackernewsRuby.api_url = @api_url
61
+ HackernewsRuby.api_version = @api_version
60
62
  end
61
63
  end
62
64
  end
@@ -1,3 +1,3 @@
1
1
  module HackernewsRuby
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -12,16 +12,7 @@ module HackernewsRuby
12
12
 
13
13
  ## configure default
14
14
  def configure
15
- load_defaults
16
15
  yield self
17
- true
18
- end
19
-
20
- private
21
-
22
- def load_defaults
23
- self.api_url ||= 'https://hacker-news.firebaseio.com'
24
- self.api_version ||= 'v0'
25
16
  end
26
17
 
27
18
  end
@@ -0,0 +1,127 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://hacker-news.firebaseio.com/v0/q?=dropbox
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Content-Type:
13
+ - application/json
14
+ User-Agent:
15
+ - Ruby Gem vy HackerNews_Ruby 0.0.2
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Allow:
24
+ - OPTIONS,GET
25
+ Access-Control-Allow-Methods:
26
+ - OPTIONS,GET
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ Content-Type:
30
+ - text/html; charset=UTF-8
31
+ Content-Length:
32
+ - '805'
33
+ body:
34
+ encoding: UTF-8
35
+ string: |
36
+ <!doctype html>
37
+ <html>
38
+ <head>
39
+ <meta charset="utf-8">
40
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
41
+ <title>Forge: Firebase Graphical Debugger</title>
42
+ <meta name="description" content="Forge: Firebase Graphical Debugger">
43
+ <meta name="author" content="Firebase, Inc.">
44
+ <meta name="viewport" content="width=device-width,initial-scale=1">
45
+
46
+ <script type="text/javascript">
47
+ var FirebaseForge = {
48
+ constants: {
49
+ web_root : "https://www.firebase.com",
50
+ cdn_root : "https://cdn.firebase.com/v0",
51
+ auth_root: "https://auth.firebase.com",
52
+ log_level: "info"
53
+ }
54
+ };
55
+ </script>
56
+
57
+ <!-- SCRIPTS -->
58
+ <script type"text/javascript" src="https://www.firebase.com/resources-prod/forge.head.loader.js"></script>
59
+
60
+ </head>
61
+ <body></body>
62
+ </html>
63
+ http_version:
64
+ recorded_at: Wed, 08 Oct 2014 20:43:06 GMT
65
+ - request:
66
+ method: get
67
+ uri: https://hacker-news.firebaseio.com/v0/q?=dropbox.json?
68
+ body:
69
+ encoding: US-ASCII
70
+ string: ''
71
+ headers:
72
+ Accept:
73
+ - application/json
74
+ Content-Type:
75
+ - application/json
76
+ User-Agent:
77
+ - Ruby Gem vy HackerNews_Ruby 0.0.2
78
+ Accept-Encoding:
79
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
80
+ response:
81
+ status:
82
+ code: 200
83
+ message: OK
84
+ headers:
85
+ Allow:
86
+ - OPTIONS,GET
87
+ Access-Control-Allow-Methods:
88
+ - OPTIONS,GET
89
+ Access-Control-Allow-Origin:
90
+ - "*"
91
+ Content-Type:
92
+ - text/html; charset=UTF-8
93
+ Content-Length:
94
+ - '805'
95
+ body:
96
+ encoding: UTF-8
97
+ string: |
98
+ <!doctype html>
99
+ <html>
100
+ <head>
101
+ <meta charset="utf-8">
102
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
103
+ <title>Forge: Firebase Graphical Debugger</title>
104
+ <meta name="description" content="Forge: Firebase Graphical Debugger">
105
+ <meta name="author" content="Firebase, Inc.">
106
+ <meta name="viewport" content="width=device-width,initial-scale=1">
107
+
108
+ <script type="text/javascript">
109
+ var FirebaseForge = {
110
+ constants: {
111
+ web_root : "https://www.firebase.com",
112
+ cdn_root : "https://cdn.firebase.com/v0",
113
+ auth_root: "https://auth.firebase.com",
114
+ log_level: "info"
115
+ }
116
+ };
117
+ </script>
118
+
119
+ <!-- SCRIPTS -->
120
+ <script type"text/javascript" src="https://www.firebase.com/resources-prod/forge.head.loader.js"></script>
121
+
122
+ </head>
123
+ <body></body>
124
+ </html>
125
+ http_version:
126
+ recorded_at: Wed, 08 Oct 2014 20:43:39 GMT
127
+ recorded_with: VCR 2.8.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackernews_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Ross
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-08 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday_middleware
@@ -200,6 +200,7 @@ files:
200
200
  - spec/cassettes/get_comment.yml
201
201
  - spec/cassettes/get_story.yml
202
202
  - spec/cassettes/get_user.yml
203
+ - spec/cassettes/item_search.yml
203
204
  - spec/cassettes/top_stories.yml
204
205
  - spec/hackernews_ruby/client_spec.rb
205
206
  - spec/hackernews_ruby_spec.rb
@@ -232,6 +233,7 @@ test_files:
232
233
  - spec/cassettes/get_comment.yml
233
234
  - spec/cassettes/get_story.yml
234
235
  - spec/cassettes/get_user.yml
236
+ - spec/cassettes/item_search.yml
235
237
  - spec/cassettes/top_stories.yml
236
238
  - spec/hackernews_ruby/client_spec.rb
237
239
  - spec/hackernews_ruby_spec.rb