Cat_api_controler 0.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/models/API_controler.rb +29 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4beba3993da704ec58a663cf9ea437c3b77e0005bd52879f5c090a1b7f06ef07
4
+ data.tar.gz: 4532599916f5ec9e49ec8dc753b321418a7f43ca625a448464729aeb5421b1f8
5
+ SHA512:
6
+ metadata.gz: 70fd24e0da0b5676b98afd89f0c765ca4ccc887b638e1d562eefbda883f65f004e230f32fde4656bafcc00ed4d5f34c4d1ae91bc654b2db5238e0331544c6bc6
7
+ data.tar.gz: 9ad00a94c66d93d0a325aa74423f11f2a9ca508430391fa79de3246595d534653d1998027855d5369a7ba4f8207b5f473299f701e77ceb0bb44bd6d05dcb1da9
@@ -0,0 +1,29 @@
1
+ require 'httparty'
2
+
3
+ module CatFactsAPI
4
+ class CatFactsAPIGet
5
+ attr_reader :facts
6
+
7
+ def get
8
+ @facts = HTTParty.get("https://catfact.ninja/fact")
9
+ @facts = JSON.parse(@facts.body)
10
+ end
11
+ end
12
+
13
+ class CatFactsAPISort
14
+ attr_reader :short_facts, :long_facts
15
+
16
+ def initialize
17
+ @short_facts = []
18
+ @long_facts = []
19
+ end
20
+
21
+ def sort(facts: CatFactsAPIGet.facts)
22
+ if facts["lenght"].to_i > 60
23
+ @short_facts << facts["fact"]
24
+ else
25
+ @long_facts << facts["fact"]
26
+ end
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Cat_api_controler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Konrad
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple cat api gem
14
+ email: konrad@quaran.to
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - models/API_controler.rb
20
+ homepage: https://github.com/Kondziorn0/API_controler_gem
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.3.7
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Cat!
43
+ test_files: []