badass 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4ab95b2d4678a5c3700ff190aa6c7ff496c6a01b61623f2dcef876f6a1f1855e
4
+ data.tar.gz: 360a3107f9d5211315f3e07eda902327971212965021856d14f2d015d8feb1b7
5
+ SHA512:
6
+ metadata.gz: ae0e9040e652e7f7eb70f6c9aeb5f9b902055f5b8995f473e11834f0d34ce698b670fb3de93e07500a925f342c4b9fa3f634ae79000b944444a6cbd05d3b8251
7
+ data.tar.gz: 29d60696eeaa0ef609bbe7f7dc83ea71524f835c909342948f8d829be43fd5d26bc25f905b691d64e1a2874ebf6dba0234428ad6a8bfe81dc6cdac6de3abd1c6
@@ -0,0 +1,14 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ module BadASS
5
+ @api_root = 'https://bad-dragon.com/api'
6
+
7
+ def self.test
8
+ return 'your gay lol'
9
+ end
10
+
11
+ end
12
+
13
+ require 'badass/client'
14
+ require 'badass/fast'
@@ -0,0 +1,32 @@
1
+ class BadASS::Client
2
+ # Creates a client to do operations.
3
+ def initialize(refresh_time: 600)
4
+ Thread.new do
5
+ @baddragon_skus = {}
6
+ JSON.parse(Net::HTTP.get(URI('https://bad-dragon.com/api/inventory-toy/product-list'))).each do |toy|
7
+ @baddragon_skus[toy['sku']] = toy['name']
8
+ end
9
+ loop do
10
+ @toys_finished = false
11
+ page = 1
12
+ @toys = []
13
+ loop do
14
+ newtoys = JSON.parse(Net::HTTP.get(URI("https://bad-dragon.com/api/inventory-toys?price[min]=0&price[max]=300&noAccessories=false&cumtube=false&suctionCup=false&sort[field]=price&&sort[direction]=asc&page=#{page}&limit=60")))
15
+ newtoys['toys'].each do |toy|
16
+ toy['name'] = @baddragon_skus[toy['sku']]
17
+ end
18
+ page += 1
19
+ @toys.concat(newtoys['toys'])
20
+ break if page > newtoys['totalPages']
21
+ end
22
+ @toys_finished = true
23
+ sleep(refresh_time)
24
+ end
25
+ end
26
+ end
27
+
28
+ def toys
29
+ sleep(0.1) until @toys_finished
30
+ @toys
31
+ end
32
+ end
@@ -0,0 +1,17 @@
1
+ class BadASS::Toy
2
+ def initialize(toy_hash)
3
+ @id = toy_hash['id'] || 000000
4
+ @title = video_hash[:title] || 'N/A'
5
+ @url = video_hash[:webpage_url] || 'N/A'
6
+ @thumbnail_url = video_hash[:thumbnail] || Bot::HBOT.profile.avatar_url
7
+ @like_count = video_hash[:like_count] || 'N/A'
8
+ @dislike_count = video_hash[:dislike_count] || 'N/A'
9
+ @view_count = video_hash[:view_count] || 'N/A'
10
+ @length = video_hash[:duration] || 0
11
+ @location = video_hash[:filename] + '.mp4'
12
+ @loop = false
13
+ @event = event
14
+ @skipped_time = 0
15
+ @filters = video_hash[:filters] || []
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: badass
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - charagarlnad
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple Bad Dragon Assistant Gem.
14
+ email: ''
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/badass.rb
20
+ - lib/badass/client.rb
21
+ - lib/badass/toy.rb
22
+ homepage: https://github.com/charagarlnad/badass
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.7.6
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Bad Dragon API for Ruby
46
+ test_files: []