lite-service 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +14 -11
- data/Gemfile.lock +1 -1
- data/README.md +5 -4
- data/lib/lite/service.rb +1 -1
- data/lib/lite/service/command.rb +6 -11
- data/lib/lite/service/exception.rb +10 -0
- data/lib/lite/service/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e6494a1b7ccefe36f2aee1a17040806bb8c4d80a737a26d0e19fedecfd79b68
|
4
|
+
data.tar.gz: f03bbccc41398f75e59182e7177c580e7b54efa9e189795a2f4cf9665ab472bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 911d83e318b8878da98e35808b4121baf0c2661299eed3c8cc9e7fe94ce08faf8c867835a8f8ea059c53e41ea10ae4d4ef1e11316371001774eaf1f360f1cdc1
|
7
|
+
data.tar.gz: 9d292b6f38cd39b008c10f90c09bfc9aaa789851c4edc08a88bb122aa095896338e2a4aeb16bf5280e4cb4d47597844b4a82c6f891b90a5e61b417876a154d21
|
data/.rubocop.yml
CHANGED
@@ -11,7 +11,7 @@ Layout/EmptyLinesAroundBlockBody:
|
|
11
11
|
Exclude:
|
12
12
|
- 'spec/**/**/*'
|
13
13
|
Layout/EmptyLinesAroundClassBody:
|
14
|
-
EnforcedStyle:
|
14
|
+
EnforcedStyle: empty_lines_except_namespace
|
15
15
|
Layout/EmptyLinesAroundModuleBody:
|
16
16
|
EnforcedStyle: empty_lines_except_namespace
|
17
17
|
Metrics/BlockLength:
|
data/.travis.yml
CHANGED
@@ -1,21 +1,24 @@
|
|
1
|
-
---
|
2
1
|
sudo: false
|
3
2
|
language: ruby
|
4
3
|
cache: bundler
|
5
4
|
rvm:
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
- 2.5
|
6
|
+
- 2.6
|
7
|
+
- ruby-head
|
9
8
|
matrix:
|
10
9
|
fast_finish: true
|
11
10
|
allow_failures:
|
12
|
-
|
11
|
+
- rvm: ruby-head
|
13
12
|
before_install:
|
14
|
-
|
15
|
-
|
13
|
+
- gem update --system
|
14
|
+
- gem install bundler
|
16
15
|
install:
|
17
|
-
|
16
|
+
- bundle install --jobs=3 --retry=3
|
18
17
|
script:
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
- bundle exec rspec
|
19
|
+
- bundle exec rubocop
|
20
|
+
- bundle exec fasterer
|
21
|
+
notifications:
|
22
|
+
email: false
|
23
|
+
slack:
|
24
|
+
secure: iKadv0MEoe97ue3H+UQQQXM0eVvNIQ9WPgNJd8BBF2WveIpUZD+jF1TxiRlyclQz8kkxLjUy+dRXZ0/Xywhexn5ItGJfGm43yZ51PIXOJ7JIAIOeAIWWdVfvnkB3X0Nvm1ClE0IgHi2aG5uLylX3S4khaQ4TcxDTebdM72cdUfdXKFBy8Rthd1lOdU8NML9pmfuClc3ymcbP9CWEGxOAbU+GBGmb1tRFKr3N1j7f9nbbLw8xXL6WjZwUmHG3LC5DYLSp6m7I1pgUVO2bZwFLwtaIGtRBCwmHwxKyHqJ/NIU8zl03ZCi4lkQW3EncAxQnugzxToBrWep/k5UO3fkVtjDliOHFvWYBpqrxJOnHx7RIvK3IGCKSkNQ1Fxfwjvq4PetIaXDGLAoy8c9k6HsINeemzB/+Np8TYkYWeOpbid/jfS+ZVmftGlVZD/+32WQ9PYts9y6xkt8kaNr7uuVSMS2CU/vt5STA3+YV3hvJJ/hjsg1ZflTOi5y4DBLwzQp02qlmzWduZRucRYwrvtjAitUmrwbUStPGjGq28ZzHJwC70OtN0QVn9tA16tb7WXtdGY3gvfbNG0AvE++5yXbQWmZN2XUXA2eqTjh3EDOvogFUNYTYyq68j7HeQSY3BnzoQZ/HEGEVDi5fOMnGVB1DG30ImqfMQe41e58OJUBGfXo=
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -35,14 +35,14 @@ Learn more about using memoization subclass in [Lite::Memoize](https://github.co
|
|
35
35
|
and errors subclass [Lite::Errors](https://github.com/drexed/lite-errors).
|
36
36
|
|
37
37
|
```ruby
|
38
|
-
class SearchMovies
|
39
|
-
prepend Lite::Service::Command
|
38
|
+
class SearchMovies < Lite::Service::Command
|
40
39
|
|
41
40
|
def initialize(name)
|
42
41
|
@name = name
|
43
42
|
end
|
44
43
|
|
45
|
-
|
44
|
+
# NOTE: This method is required to call the command
|
45
|
+
def run
|
46
46
|
{ generate_fingerprint => movies_by_name }
|
47
47
|
end
|
48
48
|
|
@@ -70,12 +70,13 @@ service = SearchMovies.new('Toy Story')
|
|
70
70
|
service.called? #=> false
|
71
71
|
service.call #=> { 'fingerprint_1' => [ 'Toy Story 1', ... ] }
|
72
72
|
service.called? #=> true
|
73
|
+
service.run #=> Returns a fresh uncached value
|
73
74
|
|
74
75
|
# or
|
75
76
|
|
76
77
|
service = SearchMovies.call('Toy Story')
|
77
78
|
service.called? #=> true
|
78
|
-
service.result #=> { 'fingerprint_1' => [ 'Toy Story
|
79
|
+
service.result #=> { 'fingerprint_1' => [ 'Toy Story 1', ... ] }
|
79
80
|
```
|
80
81
|
|
81
82
|
**Cache**
|
data/lib/lite/service.rb
CHANGED
data/lib/lite/service/command.rb
CHANGED
@@ -5,13 +5,9 @@ require 'lite/memoize'
|
|
5
5
|
|
6
6
|
module Lite
|
7
7
|
module Service
|
8
|
+
class Command
|
8
9
|
|
9
|
-
|
10
|
-
class ValidationError < StandardError; end
|
11
|
-
|
12
|
-
module Command
|
13
|
-
|
14
|
-
module ClassMethods
|
10
|
+
class << self
|
15
11
|
|
16
12
|
def call(*args)
|
17
13
|
klass = new(*args)
|
@@ -23,16 +19,16 @@ module Lite
|
|
23
19
|
|
24
20
|
attr_reader :result
|
25
21
|
|
26
|
-
def
|
27
|
-
|
22
|
+
def initialize(*args)
|
23
|
+
@args = args
|
28
24
|
end
|
29
25
|
|
30
26
|
def call
|
31
|
-
raise Lite::Service::NotImplementedError unless defined?(
|
27
|
+
raise Lite::Service::NotImplementedError unless defined?(run)
|
32
28
|
return @result if called?
|
33
29
|
|
34
30
|
@called = true
|
35
|
-
@result =
|
31
|
+
@result = run
|
36
32
|
end
|
37
33
|
|
38
34
|
def cache
|
@@ -82,6 +78,5 @@ module Lite
|
|
82
78
|
alias valid? validate!
|
83
79
|
|
84
80
|
end
|
85
|
-
|
86
81
|
end
|
87
82
|
end
|
data/lib/lite/service/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lite-errors
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- bin/setup
|
161
161
|
- lib/lite/service.rb
|
162
162
|
- lib/lite/service/command.rb
|
163
|
+
- lib/lite/service/exception.rb
|
163
164
|
- lib/lite/service/version.rb
|
164
165
|
- lite-service.gemspec
|
165
166
|
homepage: http://drexed.github.io/lite-service
|