devrant 0.0.2 → 0.0.3

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: 3c4da7cf8bf7d3411efba3fcd419ec1e7a64fb1e
4
- data.tar.gz: f81698d5ccdd68f4af78ab16d94db11c46d06efa
3
+ metadata.gz: b09d803f04ef0c5eafeb8fd121a8d2576f869828
4
+ data.tar.gz: c9714660e2855e4f5a88db7b04268a5589450874
5
5
  SHA512:
6
- metadata.gz: 506beae8ed00d19c049806f4a56d71011c866a3328339102c8c04ce9726c0ba70c28214c2699b98de80b50943248f8fa9c70d7d22eea797941967dd1c8e1acae
7
- data.tar.gz: fd98539b4fecc834cc1ce02a6a115039ee07e20ac69f36a27e6f67c252df6a260436cea59adb663c5e7c7fb91f620733f14abf3b08186abf3a4747e69070e2ce
6
+ metadata.gz: 22bcbbff65d5075d683ccf82a0cb606c38940a3c946dce3e59755f00aa4538f08bc5f81d77340bf1c3f7487c9da70966199d22ede57d085f9bf900e1b8c2b3bc
7
+ data.tar.gz: 596be6cad8543e251f2cb4273ecf458badd7f2c9f4ae25745242936fe143f0cab9c1ba3e7c519d7177e960f3383b3144f4c47c9c2d751166e18173f5a669cb90
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ .gem
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
+ [![Gem Version](https://badge.fury.io/rb/devrant.svg)](https://badge.fury.io/rb/devrant)
2
+
1
3
  # Devrant
2
4
 
5
+ ![devRant](https://devrant.com/static/devrant/img/landing/features-avatars.png)
6
+
3
7
  This gem is the unnofficial wrapper for the devRant API. It provides convinience methods and an interface to easily integrate devRant into
4
8
  your ruby projects.
5
9
 
@@ -35,14 +39,62 @@ devRant = Devrant::Api.new
35
39
 
36
40
  ### Rants
37
41
 
38
- Getting all rants:
42
+ **Getting all rants:**
43
+
44
+ ```ruby
45
+ require 'devrant'
46
+
47
+ devRant = Devrant::Api.new
48
+
49
+ devRant.rants.all
50
+ ```
51
+
52
+ **Getting rant by ID:**
53
+
54
+ ```ruby
55
+ require 'devrant'
56
+
57
+ devRant = Devrant::Api.new
58
+
59
+ devRant.rants.get_rant(1234)
60
+ ```
61
+
62
+ **Filtering Rants**
63
+
64
+ Allows you to fetch rants based on certain filters. Takes in a hash of parameters.
65
+
66
+ | Method | Parameters |
67
+ |:--------|:----------------|
68
+ |get_rants|limit, sort, skip|
69
+
70
+ _Parameter Values_
71
+
72
+ | Parameter | Values | Description |
73
+ |:---------------|:----------|:----------------------------------------------------|
74
+ |limit _Optional_|any integer| Sets a maximum limit to the amount of rants returned|
75
+ |sort _Optional_ |'recent', 'algo', 'top'| Specifies order in which to sort the rants|
76
+ |skip _Optional_ |any integer| Specifies how many rants to skip. Useful for pagination|
77
+
78
+ _Example:_
79
+
80
+ ```ruby
81
+ require 'devrant'
82
+
83
+ devRant = Devrant::Api.new
84
+
85
+ devRant.rants.get_rants({limit: 10, sort: 'algo', skip: 5})
86
+ ```
87
+
88
+ ### Users
89
+
90
+ **Getting User by ID:**
39
91
 
40
92
  ```ruby
41
93
  require 'devrant'
42
94
 
43
95
  devRant = Devrant::Api.new
44
96
 
45
- devRant.rants.get_rants
97
+ devRant.users.get_user(1234)
46
98
  ```
47
99
 
48
100
  ## Development
data/Rakefile CHANGED
@@ -7,4 +7,12 @@ task :default => :spec
7
7
 
8
8
  task :console do
9
9
  exec 'irb -r devrant -I ./lib'
10
- end
10
+ end
11
+
12
+ task :export do
13
+ # exec 'rake'
14
+ # exec 'gem build devrant.gemspec'
15
+
16
+ new_gem = Dir.glob("/pkg/*").max_by {|f| File.mtime(f)}
17
+ puts new_gem
18
+ end
data/devrant-0.0.2.gem ADDED
Binary file
data/devrant.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.15'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'pry'
26
27
  spec.add_development_dependency 'rspec', '~> 3.0'
27
28
  spec.add_runtime_dependency 'httparty'
28
29
  spec.add_runtime_dependency 'json'
data/lib/devrant.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "devrant/version"
2
2
  require "httparty"
3
3
  require "json"
4
+ require "pry"
4
5
  require "devrant/api"
5
6
  require "devrant/rants"
6
7
  require "devrant/users"
data/lib/devrant/api.rb CHANGED
@@ -2,7 +2,7 @@ module Devrant
2
2
  class Api
3
3
  HTTP_OPTIONS = {
4
4
  query: {
5
- app: 3
5
+ app: 3 # This is a temporary validation param that will likely be removed soon
6
6
  },
7
7
  base_uri: 'https://www.devrant.io/api'
8
8
  }
@@ -28,4 +28,4 @@ module Devrant
28
28
  end
29
29
  end
30
30
  end
31
- end
31
+ end
data/lib/devrant/rants.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Devrant
2
2
  class Rants
3
3
  include HTTParty
4
- include Devrant
4
+ include Devrant
5
5
 
6
6
  def all
7
7
  structuralize(self.class.get('/devrant/rants')).rants
@@ -15,6 +15,14 @@ module Devrant
15
15
  raise ArgumentError.new("No rant found for id #{id}")
16
16
  end
17
17
 
18
+ def get_rants(params={})
19
+ options = {
20
+ query: self.class.default_options[:query].merge(params)
21
+ }
22
+
23
+ rants = structuralize(self.class.get("/devrant/rants", options)).rants
24
+ end
25
+
18
26
  end
19
27
  end
20
28
 
@@ -0,0 +1,14 @@
1
+ module Devrant
2
+ class Users
3
+ include HTTParty
4
+ include Devrant
5
+
6
+ def get_user(id)
7
+ user = structuralize(self.class.get("/users/#{id}")).profile
8
+
9
+ return user unless user.nil?
10
+
11
+ raise ArgumentError.new("No user found for id #{id}")
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Devrant
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
4
+ version: 0.0.3
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-01 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.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'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -98,10 +112,12 @@ files:
98
112
  - Rakefile
99
113
  - bin/console
100
114
  - bin/setup
115
+ - devrant-0.0.2.gem
101
116
  - devrant.gemspec
102
117
  - lib/devrant.rb
103
118
  - lib/devrant/api.rb
104
119
  - lib/devrant/rants.rb
120
+ - lib/devrant/users.rb
105
121
  - lib/devrant/version.rb
106
122
  homepage: https://github.com/alexdovzhanyn/devrant
107
123
  licenses:
@@ -123,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
139
  version: '0'
124
140
  requirements: []
125
141
  rubyforge_project:
126
- rubygems_version: 2.4.8
142
+ rubygems_version: 2.6.14
127
143
  signing_key:
128
144
  specification_version: 4
129
145
  summary: The Unofficial devRant ruby API client