Class: Ruby34
- Inherits:
-
Object
- Object
- Ruby34
- Defined in:
- lib/ruby34.rb
Class Method Summary collapse
-
.hai ⇒ Object
Basically just a test function.
-
.request(limit: nil, json: nil, tags: nil, id: nil) ⇒ Object
Make a request to the Rule34 API.
Class Method Details
.hai ⇒ Object
Basically just a test function
6 7 8 |
# File 'lib/ruby34.rb', line 6 def self.hai puts "Haiii!! (from Ruby34 :3)" end |
.request(limit: nil, json: nil, tags: nil, id: nil) ⇒ Object
Make a request to the Rule34 API
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ruby34.rb', line 11 def self.request(limit: nil, json: nil, tags: nil, id: nil) # See API reference here: https://api.rule34.xxx/index.php base_uri = "https://api.rule34.xxx/index.php?page=dapi&s=post&q=index" base_uri << "&limit=" << limit if limit != nil base_uri << "&json=1" if json == true base_uri << "&tags=" << .join('+').to_s if != nil base_uri << "&id=" << id.to_s if id != nil uri = URI(base_uri) Net::HTTP.get(uri) end |