Buranya 0.5.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0c968da16a7079d076b8ef9e9534f6d9569cecae68ed62534c805f2e24beca46
4
+ data.tar.gz: 431e11f922877360c862283f530513cf7668cb281b54a0af74c6647ba6409043
5
+ SHA512:
6
+ metadata.gz: 543049eaf1062683e2eacd0631b78c854250eeb421a67ae4d08c2d64bf71760e8c08f8398cdd9add2c0463141dd00ade6aaac480e772cc8f76f67693f795cef9
7
+ data.tar.gz: c2c90d9149c3c30703d3b736aef2fb24f4aeb76014ab4e5fa4498303142672c897117c04286402c00d8f5b49206b0abc2b96c91a036c56b21183c13a0ed9b185
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
data/.idea/Buranya.iml ADDED
@@ -0,0 +1,40 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="ruby-3.1.3-p185" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.4, ruby-3.2.2-p53) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, ruby-3.2.2-p53) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.10, ruby-3.2.2-p53) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="httparty (v0.21.0, ruby-3.2.2-p53) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.6.3, ruby-3.2.2-p53) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="launchy (v2.5.2, ruby-3.2.2-p53) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.1.2, ruby-3.2.2-p53) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.18.0, ruby-3.2.2-p53) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, ruby-3.2.2-p53) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, ruby-3.2.2-p53) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.2.2.0, ruby-3.2.2-p53) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="public_suffix (v5.0.1, ruby-3.2.2-p53) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, ruby-3.2.2-p53) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, ruby-3.2.2-p53) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.7.0, ruby-3.2.2-p53) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, ruby-3.2.2-p53) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.50.1, ruby-3.2.2-p53) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.28.0, ruby-3.2.2-p53) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, ruby-3.2.2-p53) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.4.2, ruby-3.2.2-p53) [gem]" level="application" />
34
+ </component>
35
+ <component name="RakeTasksCache">
36
+ <option name="myRootTask">
37
+ <RakeTaskImpl id="rake" />
38
+ </option>
39
+ </component>
40
+ </module>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-3.2.2-p53" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/Buranya.iml" filepath="$PROJECT_DIR$/.idea/Buranya.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="d5f4fa1d-c8cf-44cd-a874-92873d5d5971" name="Changes" comment="">
5
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/lib/Buranya.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/Buranya.rb" afterDir="false" />
7
+ </list>
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="Git.Settings">
14
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
15
+ </component>
16
+ <component name="MarkdownSettingsMigration">
17
+ <option name="stateVersion" value="1" />
18
+ </component>
19
+ <component name="ProjectId" id="2OqjOI6ydTCXdtwfdScovxP2604" />
20
+ <component name="ProjectViewState">
21
+ <option name="hideEmptyMiddlePackages" value="true" />
22
+ <option name="showLibraryContents" value="true" />
23
+ </component>
24
+ <component name="PropertiesComponent"><![CDATA[{
25
+ "keyToString": {
26
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
27
+ "RunOnceActivity.ShowReadmeOnStart": "true"
28
+ }
29
+ }]]></component>
30
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
31
+ <component name="TaskManager">
32
+ <task active="true" id="Default" summary="Default task">
33
+ <changelist id="d5f4fa1d-c8cf-44cd-a874-92873d5d5971" name="Changes" comment="" />
34
+ <created>1682294975129</created>
35
+ <option name="number" value="Default" />
36
+ <option name="presentableId" value="Default" />
37
+ <updated>1682294975129</updated>
38
+ </task>
39
+ <servers />
40
+ </component>
41
+ <component name="Vcs.Log.Tabs.Properties">
42
+ <option name="TAB_STATES">
43
+ <map>
44
+ <entry key="MAIN">
45
+ <value>
46
+ <State />
47
+ </value>
48
+ </entry>
49
+ </map>
50
+ </option>
51
+ </component>
52
+ </project>
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-04-08
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in Buranya.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+
14
+ gem "httparty"
15
+
16
+ gem "launchy"
data/Gemfile.lock ADDED
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ Buranya (0.1.0)
5
+ httparty
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.8.4)
11
+ public_suffix (>= 2.0.2, < 6.0)
12
+ ast (2.4.2)
13
+ httparty (0.21.0)
14
+ mini_mime (>= 1.0.0)
15
+ multi_xml (>= 0.5.2)
16
+ json (2.6.3)
17
+ launchy (2.5.2)
18
+ addressable (~> 2.8)
19
+ mini_mime (1.1.2)
20
+ minitest (5.18.0)
21
+ multi_xml (0.6.0)
22
+ parallel (1.22.1)
23
+ parser (3.2.2.0)
24
+ ast (~> 2.4.1)
25
+ public_suffix (5.0.1)
26
+ rainbow (3.1.1)
27
+ rake (13.0.6)
28
+ regexp_parser (2.7.0)
29
+ rexml (3.2.5)
30
+ rubocop (1.50.1)
31
+ json (~> 2.3)
32
+ parallel (~> 1.10)
33
+ parser (>= 3.2.0.0)
34
+ rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8, < 3.0)
36
+ rexml (>= 3.2.5, < 4.0)
37
+ rubocop-ast (>= 1.28.0, < 2.0)
38
+ ruby-progressbar (~> 1.7)
39
+ unicode-display_width (>= 2.4.0, < 3.0)
40
+ rubocop-ast (1.28.0)
41
+ parser (>= 3.2.1.0)
42
+ ruby-progressbar (1.13.0)
43
+ unicode-display_width (2.4.2)
44
+
45
+ PLATFORMS
46
+ x64-mingw-ucrt
47
+
48
+ DEPENDENCIES
49
+ Buranya!
50
+ httparty
51
+ launchy
52
+ minitest (~> 5.0)
53
+ rake (~> 13.0)
54
+ rubocop (~> 1.21)
55
+
56
+ BUNDLED WITH
57
+ 2.4.10
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # Buranya
2
+
3
+ Welcome to Buranya! Buranya (Base of Random Knowledge) is a smol gem that allows you to get facts, jokes and cats pictures.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add buranya
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install buranya
14
+
15
+ ## Usage
16
+ To receive a random fact about a number type:
17
+
18
+ num_facts(20)
19
+
20
+ You can also specify what you want your number to be:
21
+
22
+ num_facts(20, 'date')
23
+ num_facts(20, 'math')
24
+ num_facts(20, 'year')
25
+
26
+ To receive a random joke type:
27
+
28
+ jokes
29
+
30
+ You can also get a joke of certain theme:
31
+
32
+ jokes('general')
33
+ jokes('programming')
34
+
35
+ To receive a link of cat photo of chosen breed type:
36
+
37
+ cat_pic('bengal')
38
+
39
+ You can also get a picture with full review of a breed:
40
+
41
+ cat_breed_review('bengal')
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Negative228/Buranya.
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Buranya
4
+ VERSION = "0.5.1"
5
+ end
data/lib/Buranya.rb ADDED
@@ -0,0 +1,111 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "Buranya/version"
4
+ require 'httparty'
5
+ require 'launchy'
6
+
7
+ module Buranya
8
+ class Error < StandardError; end
9
+
10
+ #module MemMethods
11
+
12
+ def num_facts(num='',type='')
13
+ #"Hi! You can choose one of four types of facts:
14
+ # 'math'
15
+ # 'date'
16
+ # 'year'
17
+ # If you don`t need a definite type of fact choose nothing"
18
+
19
+ if (num=='')
20
+ response = HTTParty.get('http://numbersapi.com/' + rand(max=10000).to_s)
21
+ else
22
+ response = HTTParty.get('http://numbersapi.com/' + num.to_s + '/' + type.to_s)
23
+ end
24
+
25
+ if response.code == 200
26
+ puts (response.body)
27
+ else
28
+ puts 'Error:', response.code, response.body
29
+ end
30
+ return response
31
+ end
32
+
33
+ def cat_pic(breed, key = 'wCwPBOjfVh4Sd6+wk5qlag==iTrhbDSMz9f3ppXh')
34
+ # use name of the cat breed in english lowercase to get image
35
+ # you may use default ninja api key for this function or use the one in your profile at api-ninjas.com
36
+ response = HTTParty.get("https://api.api-ninjas.com/v1/cats?name=#{breed.to_s}",
37
+ headers: {'X-Api-Key': key})
38
+
39
+ if response.code == 200
40
+ data = JSON.parse(response.body)[0]
41
+ if data != nil
42
+ Launchy.open(data["image_link"])
43
+ puts "image is opened in your default browser :3"
44
+ else
45
+ puts 'Wrong breed name'
46
+ end
47
+ else
48
+ puts 'Error:', response.code, response.body
49
+ end
50
+ return response
51
+ end
52
+
53
+ def cat_breed_review(breed, key = 'wCwPBOjfVh4Sd6+wk5qlag==iTrhbDSMz9f3ppXh')
54
+ # use name of the cat breed in english lowercase to get full review + image
55
+ # you may use default ninja api key for this function or use the one in your profile at api-ninjas.com
56
+ response = HTTParty.get("https://api.api-ninjas.com/v1/cats?name=#{breed}",
57
+ headers: {'X-Api-Key': key})
58
+
59
+ if response.code == 200
60
+ data = JSON.parse(response.body)[0]
61
+ if data != nil
62
+
63
+ data.each do |key, val|
64
+ case
65
+ when key != "image_link"
66
+ puts "#{breed}s #{key}>>> #{val}\n"
67
+ sleep 0.5
68
+ end
69
+ end
70
+
71
+ puts "Image of the #{breed} wil be opened in your default browser in 3 seconds"
72
+ sleep 3
73
+
74
+ Launchy.open(data["image_link"])
75
+ puts "image is opened in your default browser :3"
76
+
77
+ else
78
+ puts 'Wrong breed name'
79
+ end
80
+ else
81
+ puts 'Error:', response.code, response.body
82
+ end
83
+ return response
84
+ end
85
+
86
+ def jokes(j_type = '') # you can choose one of this types: 1) general; 2) programming.
87
+
88
+
89
+
90
+ if (j_type == '')
91
+ response = HTTParty.get('https://official-joke-api.appspot.com/random_joke')
92
+ else
93
+ response = HTTParty.get('https://official-joke-api.appspot.com/jokes/' + j_type.to_s + '/random')
94
+ end
95
+
96
+ if response.code == 200
97
+ if response.body != "[]"
98
+ puts JSON.parse(response.body)[0]["setup"]
99
+ puts JSON.parse(response.body)[0]["punchline"]
100
+ else puts "no such joke type"
101
+ end
102
+ else
103
+ puts 'Error:', response.code, response.body
104
+ end
105
+ return response
106
+ end
107
+ #end
108
+
109
+ end
110
+
111
+
data/sig/Buranya.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Buranya
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Buranya
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.1
5
+ platform: ruby
6
+ authors:
7
+ - Negative
8
+ - Luneroshay
9
+ - maplesyropp
10
+ - Askobarus
11
+ - Arantir
12
+ autorequire:
13
+ bindir: exe
14
+ cert_chain: []
15
+ date: 2023-04-24 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: httparty
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: launchy
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ description:
46
+ email:
47
+ - - mafilimonov@sfedu.ru
48
+ - - dridadodridado@gmail.com
49
+ - - iberezhnaia@sfedu.ru
50
+ - - sesalnikov@sfedu.ru
51
+ - - glebatya2281@yandex.ru
52
+ executables: []
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - ".idea/.gitignore"
57
+ - ".idea/Buranya.iml"
58
+ - ".idea/misc.xml"
59
+ - ".idea/modules.xml"
60
+ - ".idea/vcs.xml"
61
+ - ".idea/workspace.xml"
62
+ - ".rubocop.yml"
63
+ - CHANGELOG.md
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - README.md
67
+ - Rakefile
68
+ - lib/Buranya.rb
69
+ - lib/Buranya/version.rb
70
+ - sig/Buranya.rbs
71
+ homepage: https://github.com/Negative228/Buranya
72
+ licenses: []
73
+ metadata:
74
+ homepage_uri: https://github.com/Negative228/Buranya
75
+ source_code_uri: https://github.com/Negative228/Buranya
76
+ changelog_uri: https://github.com/Negative228/Buranya/blob/main/README.md
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 2.6.0
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubygems_version: 3.4.10
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Cat pictures and jokes (mostly)
96
+ test_files: []