inaw 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6f344fe8e7e4aa8411c6c73b55774914c1017c38e7708e60d81771343667ed9e
4
+ data.tar.gz: 7a38b9e5fb0c59d9628c6624f83fd9cfe93b7db3e13ccbfd692d98d6af125955
5
+ SHA512:
6
+ metadata.gz: 67310a2906c22205520545b9c1db517872af892a736d984b3019fb9e398ed5f3beae4c2b8214220a1dc39bda2e7a99a7be710bb879b9fac6904b20c8851784f2
7
+ data.tar.gz: de130d5fcd17b9499b16b6b01c5d96c57ea2d68af5dfdf9ac97f4f59fa2452b2e52b298d63997bf2e90701d196c3823c506850c9a862bd823a47c42f41aa48d1
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in inaw.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 realYuushi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # INAW (I Need A Word)
2
+
3
+ **INAW** is a RubyGem that allows to randomly choose a word in different languages.
4
+ For the time being it only has online support, which means it will choose a word on random word generator website but I will add offline support in the near future.
5
+ Languages available are: Arabic (AR), Danish, (DA), Dutch (NL), Finnish (FI), French (FR), German (DE), Italian (IT), Portuguese (PT), Spanish (ES), Swedish (SV).
6
+ See **Usage** for how to use INAW.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'inaw'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install inaw
23
+
24
+ ## Usage
25
+
26
+ Available languages parameters are: AR, DA, DE, ES, FI, FR, IT, NL, PT, SV.
27
+
28
+ ```ruby
29
+ require INAW
30
+
31
+ # chooses a random English word
32
+ random_english_word = INAW.word('EN')
33
+
34
+ # chooses a random French word
35
+ random_english_word = INAW.word('FR')
36
+ ```
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[realYuushi/i-need-a-word.
41
+
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "inaw"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,26 @@
1
+ require_relative 'lib/inaw/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "inaw"
5
+ spec.version = INAW::VERSION
6
+ spec.authors = ["realYuushi"]
7
+ spec.email = ["real.yuushi@gmail.com"]
8
+
9
+ spec.summary = 'Chooses a random word.'
10
+ spec.description = 'Chooses a random word in different languages.'
11
+ spec.homepage = 'https://github.com/realYuushi/i-need-a-word'
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "https://github.com/realYuushi/i-need-a-word"
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+ end
@@ -0,0 +1,22 @@
1
+ require "inaw/version"
2
+ require 'Nokogiri'
3
+ require 'open-uri'
4
+ require 'net/http'
5
+
6
+ module INAW
7
+ @languages = {'AR' => 'kalimat-eashwayiya.php', 'DA' => 'tilfaeldige-ord.php', 'DE' => 'zufallige-worter.php', 'EN' => 'random-words.php', 'ES' => 'index.php',
8
+ 'FI' => 'satunnaiset-sanat.php', 'FR' => 'mots-aleatoires.php', 'IT' => 'parole-casuali.php', 'NL' => 'willekeurige-woorden.php',
9
+ 'PT' => 'palavras-aleatorias.php', 'SV' => 'slumpade-ord.php'}
10
+ def self.word(lang)
11
+ lang = lang.upcase
12
+ if @languages.include? lang
13
+ url = 'https://www.palabrasaleatorias.com/' + @languages[lang]
14
+ uri = URI.parse(url)
15
+ html = Net::HTTP.get_response(uri)
16
+ response = Nokogiri::HTML(html.body)
17
+ description = response.css("div")[1].text.strip
18
+ else
19
+ puts '[INAW] This language is not supported.'
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module INAW
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inaw
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - realYuushi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-08-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Chooses a random word in different languages.
14
+ email:
15
+ - real.yuushi@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - LICENSE.txt
23
+ - README.md
24
+ - Rakefile
25
+ - bin/console
26
+ - bin/setup
27
+ - inaw.gemspec
28
+ - lib/inaw.rb
29
+ - lib/inaw/version.rb
30
+ homepage: https://github.com/realYuushi/i-need-a-word
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ homepage_uri: https://github.com/realYuushi/i-need-a-word
35
+ source_code_uri: https://github.com/realYuushi/i-need-a-word
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.3.0
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.1.2
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Chooses a random word.
55
+ test_files: []