dblruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/dblruby.rb +21 -0
  3. data/lib/dblruby/stats.rb +15 -0
  4. metadata +59 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 03cc39920d1adcff5394fb49b8a646e76400194b
4
+ data.tar.gz: f5ee8b7c4b13f33f0b4ed8ac6aa01c139602c367
5
+ SHA512:
6
+ metadata.gz: 8541b9146c8b546d8b83cbcfffff2714691c0b0477b434ea3ab2817be0bbb909cfb7e226137141acb10bf31afe84599ed10ee6ad25bf4ec46dbc50b17a5cbb22
7
+ data.tar.gz: 1c35c6fd1e2fbbf8810f7fb1dab84a01aee825d5f5c670071537a4aee0dbfe7ac9032a56096809c1f39b3a364d1d451f360501eef466df4279fda5e249752ca4
data/lib/dblruby.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'json'
2
+ require 'rest-client'
3
+
4
+ # All DBLRuby functionality, whether extended or just here.
5
+ class DBLRuby
6
+ # Initialize a new DBL API, via a key.
7
+ def initialize(apikey, id)
8
+ @api = apikey
9
+ @id = id
10
+ makestats
11
+ end
12
+
13
+ # Initialize stats
14
+ def makestats
15
+ @stats = Stats.new(@api, @id)
16
+ end
17
+
18
+ attr_reader :stats
19
+ end
20
+
21
+ require 'dblruby/stats'
@@ -0,0 +1,15 @@
1
+ # Stats and stuff, ya know.
2
+ class DBLRuby::Stats
3
+ # Initialize the stats
4
+ # Program does this automatically when running DBLRuby.new.
5
+ def initialize(apikey, id)
6
+ @api = apikey
7
+ @id = id
8
+ end
9
+
10
+ # Get the server count, returns an int.
11
+ def servercount
12
+ url = "https://discordbots.org/api/bots/#{@id}"
13
+ JSON.parse(RestClient.get(url))['server_count'].to_i
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dblruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chewsterchew
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.0.rc1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.1.0.rc1
27
+ description: A gem made for the Discord Bot List in ruby.
28
+ email: chew@chew.pw
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/dblruby.rb
34
+ - lib/dblruby/stats.rb
35
+ homepage: http://rubygems.org/gems/dblruby
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 2.6.13
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: A gem made for DBL in ruby.
59
+ test_files: []