listcordrb 0.3.1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88b997be35a8a0d96eb6fa0985cb2c2dc08b680e
4
- data.tar.gz: e8bb8208be552aec1b6fe5ea6a178f633e687eab
3
+ metadata.gz: 81efa44cc9f5ec2eeaf1ad5ff2b6266d9119b0c2
4
+ data.tar.gz: c8e60fd7d58e3d1f8b947c707535af66afc1d640
5
5
  SHA512:
6
- metadata.gz: 3e4169550541bde29ec8ab9c8a76e8b33b28b1d4de0be70eef95622b59dcdf4fa5800a8c98bef60e21bb5bea05a8136d4db08a8a391aef78d31fd8f1894c864d
7
- data.tar.gz: c754cce5b667bf20ad8e9f3f70661ab7f63ef611b62f76d00797f9b902176e49c1f2c03bc9a499bdae50a3ef68430fad73faa3986abb397f9150e485cb65dc11
6
+ metadata.gz: 6195d99ef148235a5fb490d030df31002f7b23d072c7507465ad6469748a4f90cbd1c9c2de2107e89fbfb7e5054d550795cb819180d3f80bb7f58a4902d1a44c
7
+ data.tar.gz: 4ea9f14954056a4c1072ae6b0ae70eb99396d9c443121691f8f98a717d06e99d66111b43ef068136d4de5ef04b78ddc2f783175495e19224880b739f59613638
@@ -38,10 +38,21 @@ class ListCordRB
38
38
  @bot = Bot.new(id)
39
39
  end
40
40
 
41
+ # Find a bot.
42
+ # Initialize the get bots
43
+ # @param query [String] Name of the bot.
44
+ # @param sort [String] Type of sort, can be votes, servers, newest, or invites, default votes.
45
+ # @param limit [Integer] amount of bots to return. Max 10, default 1.
46
+ # @param page [Integer] page of bots, takes limit and mulitplies by this.
47
+ def getbots(query, sort = 'votes', limit = 1, page = 1)
48
+ GetBots.new(query, sort, limit, page)
49
+ end
50
+
41
51
  attr_reader :stats
42
52
  attr_reader :bot
43
53
  end
44
54
 
45
55
  # Require files
46
- require 'listcordrb/stats'
47
56
  require 'listcordrb/bot'
57
+ require 'listcordrb/getbots'
58
+ require 'listcordrb/stats'
@@ -105,14 +105,32 @@ class ListCordRB::Bot
105
105
  alias guild servers
106
106
  alias server servers
107
107
 
108
+ # Get the bot's prefix
109
+ # @return [Integer] the bot's prefix.
110
+ def prefix
111
+ @data['prefix']
112
+ end
113
+
108
114
  # The amount of upvotes the bot has.
109
115
  # @return [Integer] the bot's total votes.
110
116
  def votes
111
117
  @data['votes'].to_i
112
118
  end
113
119
 
120
+ # The verified status of the bot.
121
+ # @return [true, false] the bot's verified status.
122
+ def verified?
123
+ @data['verified']
124
+ end
125
+
114
126
  # The certified status of the bot.
115
127
  # @return [true, false] the bot's certified status.
128
+ def certified?
129
+ @data['certified']
130
+ end
131
+
132
+ # The premium status of the bot.
133
+ # @return [true, false] the bot's premium status.
116
134
  def premium?
117
135
  @data['premium']
118
136
  end
@@ -0,0 +1,43 @@
1
+ # Stats and stuff, ya know.
2
+ class ListCordRB::GetBots
3
+ # Initialize the get bots
4
+ # @param query [String] Name of the bot.
5
+ # @param sort [String] Type of sort, can be votes, servers, newest, or invites, default votes.
6
+ # @param limit [Integer] amount of bots to return. Max 10, default 1.
7
+ # @param page [Integer] page of bots, takes limit and mulitplies by this.
8
+ def initialize(query, sort = 'votes', limit = 1, page = 1)
9
+ @query = query
10
+ @sort = sort
11
+ @limit = limit
12
+ @page = page
13
+ url = "https://listcord.com/api/bots/#{sort}/#{limit}/#{page * limit - 1}"
14
+ @data = JSON.parse(RestClient.get(url, params: { q: query }))
15
+ end
16
+
17
+ # @return data in raw json form.
18
+ attr_reader :data
19
+
20
+ alias to_s data
21
+
22
+ # @return the original query.
23
+ attr_reader :query
24
+
25
+ # @return the original sort method.
26
+ attr_reader :sort
27
+
28
+ # @return the original limit.
29
+ attr_reader :limit
30
+
31
+ # @return the original page.
32
+ attr_reader :page
33
+
34
+ # Go to the next page of bots
35
+ def next
36
+ ListCordRB::GetBots.new(@query, @sort, @limit, @page + 1)
37
+ end
38
+
39
+ # @return [Integer] the ID of the first bot
40
+ def first
41
+ @data[0].to_i
42
+ end
43
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: listcordrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chewsterchew
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-16 00:00:00.000000000 Z
11
+ date: 2018-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.1.0.rc1
27
- description: A Ruby library for the ListCord bot list (https://listcord.com) API.
27
+ description: A Ruby library for the Listcord bot list (https://listcord.com) API.
28
28
  email: chew@chew.pw
29
29
  executables: []
30
30
  extensions: []
@@ -32,16 +32,17 @@ extra_rdoc_files: []
32
32
  files:
33
33
  - lib/listcordrb.rb
34
34
  - lib/listcordrb/bot.rb
35
+ - lib/listcordrb/getbots.rb
35
36
  - lib/listcordrb/stats.rb
36
- homepage: http://github.com/Chewsterchew/ListCordRB
37
+ homepage: http://github.com/Chewsterchew/ListcordRB
37
38
  licenses:
38
39
  - MIT
39
40
  metadata:
40
- bug_tracker_uri: https://github.com/Chewsterchew/ListCordRB/issues
41
- changelog_uri: https://github.com/Chewsterchew/ListCordRB/releases
42
- homepage_uri: http://github.com/Chewsterchew/ListCordRB
43
- source_code_uri: http://github.com/Chewsterchew/ListCordRB
44
- wiki_uri: http://github.com/Chewsterchew/ListCordRB/wiki
41
+ bug_tracker_uri: https://github.com/Chewsterchew/ListcordRB/issues
42
+ changelog_uri: https://github.com/Chewsterchew/ListcordRB/releases
43
+ homepage_uri: http://github.com/Chewsterchew/ListcordRB
44
+ source_code_uri: http://github.com/Chewsterchew/ListcordRB
45
+ wiki_uri: http://github.com/Chewsterchew/ListcordRB/wiki
45
46
  post_install_message:
46
47
  rdoc_options: []
47
48
  require_paths:
@@ -61,5 +62,5 @@ rubyforge_project:
61
62
  rubygems_version: 2.6.14
62
63
  signing_key:
63
64
  specification_version: 4
64
- summary: ListCord API for Ruby
65
+ summary: Listcord API for Ruby
65
66
  test_files: []