listcordrb 0.1.0
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 +7 -0
- data/lib/listcordrb.rb +25 -0
- data/lib/listcordrb/stats.rb +25 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7c67bd0088cbce432e081fa04e9d9f36ad10c5b5
|
4
|
+
data.tar.gz: 8de5b47ffeb7daa617cea8081a81d81a1e23ec5b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f288d6241675eb8ee26808b7005e39f16bbfc66f7f6a615a013a45fef73ff6471c06bc3ece60e8dda97ca1c0cb225b99d896a8c5178dcfa131992d12591ec366
|
7
|
+
data.tar.gz: 3ff1be51bcb9db4fab9fa1c8d1faf2c6f916521e3b2e59a90f5549ad0b19da455f3b4e5bade36ba431cc7e1630874a46005c90eff1cdb7a4c610fb018441218a
|
data/lib/listcordrb.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Require external gems
|
2
|
+
require 'json'
|
3
|
+
require 'rest-client'
|
4
|
+
|
5
|
+
# All ListCordRB functionality, whether extended or just here.
|
6
|
+
class ListCordRB
|
7
|
+
# Initialize a new ListCord instance, via an api-key.
|
8
|
+
# @param apikey [String] API Key of the bot, received from the ListCord API doc site.
|
9
|
+
# @param id [Integer, String] Integer/String of your bot's id.
|
10
|
+
def initialize(apikey, id)
|
11
|
+
@api = apikey
|
12
|
+
@id = id
|
13
|
+
makestats
|
14
|
+
end
|
15
|
+
|
16
|
+
# Initialize Stats
|
17
|
+
def makestats
|
18
|
+
@stats = Stats.new(@api, @id)
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_reader :stats
|
22
|
+
end
|
23
|
+
|
24
|
+
# Require files
|
25
|
+
require 'listcordrb/stats'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Stats and stuff, ya know.
|
2
|
+
class ListCordRB::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 servers
|
12
|
+
url = "http://listcord.com/api/bot/#{@id}"
|
13
|
+
JSON.parse(RestClient.get(url))['servers'].to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
alias servercount servers
|
17
|
+
|
18
|
+
def servers=(count)
|
19
|
+
url = "http://listcord.com/api/bot/#{@id}/guilds"
|
20
|
+
json = '{"guilds":' + count.to_i + '}'
|
21
|
+
RestClient.post(url, json, :Authorization => @api, :'Content-Type' => :json)
|
22
|
+
end
|
23
|
+
|
24
|
+
alias updateservers servers=
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: listcordrb
|
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-07-01 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 Ruby library for the ListCord bot list (https://listcord.com) API.
|
28
|
+
email: chew@chew.pw
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/listcordrb.rb
|
34
|
+
- lib/listcordrb/stats.rb
|
35
|
+
homepage: http://github.com/Chewsterchew/ListCordRB
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata:
|
39
|
+
bug_tracker_uri: https://github.com/Chewsterchew/ListCordRB/issues
|
40
|
+
changelog_uri: https://github.com/Chewsterchew/ListCordRB/releases
|
41
|
+
homepage_uri: http://github.com/Chewsterchew/ListCordRB
|
42
|
+
source_code_uri: http://github.com/Chewsterchew/ListCordRB
|
43
|
+
wiki_uri: http://github.com/Chewsterchew/ListCordRB/wiki
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.2.4
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.6.14
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: ListCord API for Ruby
|
64
|
+
test_files: []
|