kilya 0.0.8 → 0.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a3f110ce68d21c0ece35a75a4dc342e42eefec0a64724aeea1e3ba2654cf3ba
4
- data.tar.gz: f9fd21dca091d4b2761ca2919bd36acbfec0f04ba779c323322ae733e3c4ab16
3
+ metadata.gz: 7f885532921685dd80e9fa6506957715d2a4c19f0eae3b20f34ddec5e29dc5be
4
+ data.tar.gz: 80bbcb8a41cbdf6422dd150ad61f16445353bc6cb7f62056f2109bf155163c9a
5
5
  SHA512:
6
- metadata.gz: 92991d3145471311233098eb8fbecaa38b0d134c269cde3dbd10055982e5c39f2142b89b18d0f84d2dc8856ed93aeaaa955e20aa29589a01af5005e72aeb0c1d
7
- data.tar.gz: fb97e979f816064c309b4d337ca11edf7888eb9b0191695800e65e010423fc897cee0bb300823c48021b9c7248c21d8fc5256ec69820b530546c33cd03d55c72
6
+ metadata.gz: 7fff8d8f743f78468adcf96dcb1b417a04b921a67bb384f2ec6c7491a54fe0064d4a35988cc03d59e313e157772935738179e6331a72267eb246838e014043ed
7
+ data.tar.gz: a7372840ee44c591ab193c6afd194c76f4555d1d2985663d44d2081f4ec04b42f4f88d3857a7887b43479060493c4169acf06e887be16f81e0650e11faa7ba88
data/.rubocop.yml ADDED
@@ -0,0 +1,61 @@
1
+ AllCops:
2
+ Exclude:
3
+ - config/*
4
+ - Gemfile
5
+ - test/*
6
+ - Rakefile
7
+ - kilya.gemspec
8
+
9
+ Style/FrozenStringLiteralComment:
10
+ Enabled: false
11
+
12
+ Metrics/LineLength:
13
+ Max: 190
14
+
15
+ Style/Documentation:
16
+ Enabled: false
17
+
18
+ Style/StringLiterals:
19
+ Enabled: false
20
+
21
+ Style/GlobalVars:
22
+ Enabled: false
23
+
24
+ Metrics/MethodLength:
25
+ Max: 77
26
+
27
+ Metrics/BlockLength:
28
+ Max: 177
29
+
30
+ Naming/PredicateName:
31
+ Enabled: false
32
+
33
+ Style/GuardClause:
34
+ Enabled: false
35
+
36
+ Metrics/AbcSize:
37
+ Enabled: false
38
+
39
+ Style/MixinUsage:
40
+ Enabled: false
41
+
42
+ Lint/AmbiguousOperator:
43
+ Enabled: false
44
+
45
+ Naming/MemoizedInstanceVariableName:
46
+ Enabled: false
47
+
48
+ Naming/VariableNumber:
49
+ Enabled: false
50
+
51
+ Layout/DefEndAlignment:
52
+ Enabled: false
53
+
54
+ Style/MultilineIfModifier:
55
+ Enabled: false
56
+
57
+ Style/RaiseArgs:
58
+ Enabled: false
59
+
60
+ Style/IdenticalConditionalBranches:
61
+ Enabled: false
data/.travis.yml CHANGED
@@ -5,4 +5,4 @@ branches:
5
5
  only:
6
6
  - master
7
7
  script:
8
- - rake test
8
+ - rake
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019-2022 Kondratev Ilya
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
13
+ in 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 NON-INFRINGEMENT. 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 THE
21
+ SOFTWARE.
data/Rakefile CHANGED
@@ -1,8 +1,16 @@
1
- require 'rake/testtask'
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ desc "Run spec"
5
+ task default: %i[test rubocop]
2
6
 
7
+ require 'rake/testtask'
3
8
  Rake::TestTask.new do |test|
4
9
  test.libs << 'test'
5
10
  end
6
11
 
7
- desc "Run test"
8
- task :default => :test
12
+ require 'rubocop/rake_task'
13
+ RuboCop::RakeTask.new do |task|
14
+ task.fail_on_error = true
15
+ task.requires << 'rubocop-rake'
16
+ end
data/kilya.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.rubygems_version = '2.7'
8
8
  s.required_ruby_version = '>=2.2'
9
9
  s.name = 'kilya'
10
- s.version = '0.0.8'
10
+ s.version = '0.0.9'
11
11
  s.executables << 'kilya'
12
12
  s.license = 'MIT'
13
13
  s.summary = 'Simple first Ruby gem'
@@ -17,4 +17,6 @@ Gem::Specification.new do |s|
17
17
  s.homepage = 'https://github.com/ikondratev/kilya'
18
18
  s.files = `git ls-files`.split($RS)
19
19
  s.add_dependency 'faraday', '2.2'
20
+ s.add_dependency 'rubocop', '~> 1.26'
21
+ s.add_dependency 'rubocop-rake'
20
22
  end
data/lib/kilya.rb CHANGED
@@ -1,17 +1,31 @@
1
- # main point
1
+ # frozen_string_literal: true
2
+
3
+ # (The MIT License)
4
+ #
5
+ # Copyright (c) 2019-2021 Kondratev Ilya
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the 'Software'), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+
2
25
  require 'services/string_builder'
3
26
  require 'services/requester'
4
27
 
5
28
  class Kilya
6
- # It's my first simple gem
7
- #
8
- # Example:
9
- # >> Kilya.reverse("abcd")
10
- # => "dcba"
11
- # >> Kilya.request("http://example.com")
12
- # =><HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"> ...
13
- # Arguments:
14
- # line: (String)
15
29
  class << self
16
30
  include Services::StringBuilder
17
31
 
@@ -1,3 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # (The MIT License)
4
+ #
5
+ # Copyright (c) 2019-2021 Kondratev Ilya
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the 'Software'), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+
1
25
  require 'faraday'
2
26
 
3
27
  module Services
@@ -5,7 +29,7 @@ module Services
5
29
  # @param [String] method: default get
6
30
  # @param [String] url: example: "http://example.com"
7
31
  # @return [Hash] response
8
- def request(method: :get, url:)
32
+ def request(url:, method: "get")
9
33
  result = Faraday.send(method, url)
10
34
  parse_response(result)
11
35
  rescue StandardError
@@ -17,15 +41,15 @@ module Services
17
41
  def parse_response(result)
18
42
  {
19
43
  status: result.status,
20
- body: result.body
44
+ body: result.body
21
45
  }
22
46
  end
23
47
 
24
48
  def error_response
25
49
  OpenStruct.new(
26
50
  status: 500,
27
- body: "Backend Error"
51
+ body: "Backend error"
28
52
  )
29
53
  end
30
54
  end
31
- end
55
+ end
@@ -1,7 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # (The MIT License)
4
+ #
5
+ # Copyright (c) 2019-2021 Kondratev Ilya
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the 'Software'), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+
1
25
  module Services
2
26
  module StringBuilder
27
+ class StringBuilderError < StandardError; end
28
+
29
+ # @param [String] line
30
+ # @return [String]
31
+ # @raise [StringBuilderError]
3
32
  def reverse(line)
4
33
  line.nil? ? "nothing to reverse" : line.reverse!
34
+ rescue StandardError => e
35
+ StringBuilderError.new(e.message)
5
36
  end
6
37
  end
7
- end
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kilya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Kondratev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-15 00:00:00.000000000 Z
11
+ date: 2022-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.26'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.26'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  description: Class Kilya for test new gem.
28
56
  email: ilyafulleveline@gmail.com
29
57
  executables:
@@ -32,8 +60,10 @@ extensions: []
32
60
  extra_rdoc_files: []
33
61
  files:
34
62
  - ".gitignore"
63
+ - ".rubocop.yml"
35
64
  - ".travis.yml"
36
65
  - Gemfile
66
+ - LICENSE.txt
37
67
  - README.md
38
68
  - Rakefile
39
69
  - bin/kilya