devrant 0.0.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/README.md +85 -0
- data/Rakefile +6 -6
- data/lib/devrant.rb +4 -0
- data/lib/devrant/rants.rb +20 -4
- data/lib/devrant/users.rb +9 -1
- data/lib/devrant/version.rb +1 -1
- metadata +2 -3
- data/devrant-0.0.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ac9fa760f49b06fed3e7b66392b4d534f198ca3
|
4
|
+
data.tar.gz: 0f470c1484c7667ab01130a5e19d387acee4a530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aee605184737fe636fb77f0f7b05a99149dc4474cfd0b322d8825079233fc2487e05593ef00594600a336a21d23c6e930503bd0a0ef882bbbe8b4b877c544963
|
7
|
+
data.tar.gz: 75b098d6dcaf114b60c1b5371d712223a4f088626330d1a187f400f79734e3b2ce80abe6b61afd4bb50f42b78409983b6225a33620d3ab57618c2be00b75ff00
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -85,6 +85,66 @@ devRant = Devrant::Api.new
|
|
85
85
|
devRant.rants.get_rants({limit: 10, sort: 'algo', skip: 5})
|
86
86
|
```
|
87
87
|
|
88
|
+
**Getting the Weekly Rants**
|
89
|
+
|
90
|
+
Find all rants that are featured weekly
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
require 'devrant'
|
94
|
+
|
95
|
+
devRant = Devrant::Api.new
|
96
|
+
|
97
|
+
devRant.rants.weekly
|
98
|
+
```
|
99
|
+
|
100
|
+
**Getting Story Rants**
|
101
|
+
|
102
|
+
Get rants that are categorized as a 'story'
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
require 'devrant'
|
106
|
+
|
107
|
+
devRant = Devrant::Api.new
|
108
|
+
|
109
|
+
devRant.rants.stories
|
110
|
+
```
|
111
|
+
|
112
|
+
**Getting Collabs**
|
113
|
+
|
114
|
+
Fetches all collabs
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
require 'devrant'
|
118
|
+
|
119
|
+
devRant = Devrant::Api.new
|
120
|
+
|
121
|
+
devRant.rants.collabs
|
122
|
+
```
|
123
|
+
|
124
|
+
**Searching Rants**
|
125
|
+
|
126
|
+
Search rants by a specific search term
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
require 'devrant'
|
130
|
+
|
131
|
+
devRant = Devrant::Api.new
|
132
|
+
|
133
|
+
devRant.rants.search('your search term here')
|
134
|
+
```
|
135
|
+
|
136
|
+
**Getting a Random Rant**
|
137
|
+
|
138
|
+
Returns a random rant with at least 15++
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
require 'devrant'
|
142
|
+
|
143
|
+
devRant = Devrant::Api.new
|
144
|
+
|
145
|
+
devRant.rants.random
|
146
|
+
```
|
147
|
+
|
88
148
|
### Users
|
89
149
|
|
90
150
|
**Getting User by ID:**
|
@@ -97,6 +157,16 @@ devRant = Devrant::Api.new
|
|
97
157
|
devRant.users.get_user(1234)
|
98
158
|
```
|
99
159
|
|
160
|
+
**Getting User ID from Username**
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
require 'devrant'
|
164
|
+
|
165
|
+
devRant = Devrant::Api.new
|
166
|
+
|
167
|
+
devRant.users.get_user_id('RuntimeError')
|
168
|
+
```
|
169
|
+
|
100
170
|
## Development
|
101
171
|
|
102
172
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -114,3 +184,18 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
114
184
|
## Code of Conduct
|
115
185
|
|
116
186
|
Everyone interacting in the Devrant project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/alexdovzhanyn/devrant/blob/master/CODE_OF_CONDUCT.md).
|
187
|
+
|
188
|
+
# Endpoints to Implement
|
189
|
+
|
190
|
+
- ~~/devrant/rants~~
|
191
|
+
- ~~/devrant/rants/:id~~
|
192
|
+
- ~~/users/get-user-id~~
|
193
|
+
- ~~/users/:id~~
|
194
|
+
- /comments
|
195
|
+
- /vote
|
196
|
+
- ~~/devrant/search~~
|
197
|
+
- ~~/devrant/weekly-rants~~
|
198
|
+
- ~~/devrant/story-rants~~
|
199
|
+
- ~~/devrant/collabs~~
|
200
|
+
- ~~/devrant/rants/surprise~~
|
201
|
+
- /users/auth-token
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
|
-
|
3
|
+
require "pry"
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
6
|
task :default => :spec
|
@@ -10,9 +10,9 @@ task :console do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
task :export do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
system 'rake'
|
14
|
+
system 'gem build devrant.gemspec'
|
15
|
+
new_gem = Dir.glob("*").max_by {|f| File.mtime(f)}
|
16
|
+
|
17
|
+
system "gem push #{new_gem}"
|
18
18
|
end
|
data/lib/devrant.rb
CHANGED
data/lib/devrant/rants.rb
CHANGED
@@ -7,6 +7,22 @@ module Devrant
|
|
7
7
|
structuralize(self.class.get('/devrant/rants')).rants
|
8
8
|
end
|
9
9
|
|
10
|
+
def weekly
|
11
|
+
structuralize(self.class.get('/devrant/weekly-rants')).rants
|
12
|
+
end
|
13
|
+
|
14
|
+
def random
|
15
|
+
structuralize(self.class.get('/devrant/rants/surprise')).rant
|
16
|
+
end
|
17
|
+
|
18
|
+
def stories
|
19
|
+
structuralize(self.class.get('/devrant/story-rants')).rants
|
20
|
+
end
|
21
|
+
|
22
|
+
def collabs
|
23
|
+
structuralize(self.class.get('/devrant/collabs')).rants
|
24
|
+
end
|
25
|
+
|
10
26
|
def get_rant(id)
|
11
27
|
rant = structuralize(self.class.get("/devrant/rants/#{id}")).rant
|
12
28
|
|
@@ -16,11 +32,11 @@ module Devrant
|
|
16
32
|
end
|
17
33
|
|
18
34
|
def get_rants(params={})
|
19
|
-
|
20
|
-
|
21
|
-
}
|
35
|
+
structuralize(self.class.get('/devrant/rants', extend_request_query(params))).rants
|
36
|
+
end
|
22
37
|
|
23
|
-
|
38
|
+
def search(term)
|
39
|
+
structuralize(self.class.get('/devrant/search', extend_request_query({term: term}))).results
|
24
40
|
end
|
25
41
|
|
26
42
|
end
|
data/lib/devrant/users.rb
CHANGED
@@ -3,12 +3,20 @@ module Devrant
|
|
3
3
|
include HTTParty
|
4
4
|
include Devrant
|
5
5
|
|
6
|
-
def
|
6
|
+
def get_user_by_id(id)
|
7
7
|
user = structuralize(self.class.get("/users/#{id}")).profile
|
8
8
|
|
9
9
|
return user unless user.nil?
|
10
10
|
|
11
11
|
raise ArgumentError.new("No user found for id #{id}")
|
12
12
|
end
|
13
|
+
|
14
|
+
def get_user_id(username)
|
15
|
+
id = structuralize(self.class.get('/get-user-id', extend_request_query({username: username}))).user_id
|
16
|
+
|
17
|
+
return id unless id.nil?
|
18
|
+
|
19
|
+
raise ArgumentError.new("No user called #{username} found.")
|
20
|
+
end
|
13
21
|
end
|
14
22
|
end
|
data/lib/devrant/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devrant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dovzhanyn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,7 +112,6 @@ files:
|
|
112
112
|
- Rakefile
|
113
113
|
- bin/console
|
114
114
|
- bin/setup
|
115
|
-
- devrant-0.0.2.gem
|
116
115
|
- devrant.gemspec
|
117
116
|
- lib/devrant.rb
|
118
117
|
- lib/devrant/api.rb
|
data/devrant-0.0.2.gem
DELETED
Binary file
|