inflect 0.3.2 → 0.3.3
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 +4 -4
- data/lib/inflect/response.rb +6 -15
- data/lib/inflect/responsive.rb +2 -2
- data/lib/inflect/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef4ebd82aeec1ab6cbee6f7ded7c99b1408128bd
|
4
|
+
data.tar.gz: 4d37bf7179f3914425fa2163d8db7ef2d0e48729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 795a6154df6cadf12edbc30c5137087fbc556c9bbbf5a7cf45e05ea64b79f50f2bd32e09e744a7df463a993a01db7952f4ede375db62ef9a3e6d12166a5f85c4
|
7
|
+
data.tar.gz: 785036b7e231c324d0cddcc82c2c244209ca61b0ac473eaf954b4d9b390883c5ae61abacc625530ca318b186fad93a20d26ea3014881919d06935b08622ea72b
|
data/lib/inflect/response.rb
CHANGED
@@ -14,16 +14,16 @@ module Inflect
|
|
14
14
|
attr_reader :errors
|
15
15
|
|
16
16
|
# @param content [String, Hash] The response of the service. Required.
|
17
|
-
# @param
|
18
|
-
# @option
|
19
|
-
# @option
|
20
|
-
# @option
|
17
|
+
# @param attributes [Hash] Contains all the attributes of service response.
|
18
|
+
# @option attributes [Class] :served_by Handler Service. Instance of AbstractService. Required.
|
19
|
+
# @option attributes [Array<String>] :query_words The list of words received on the request. Required.
|
20
|
+
# @option attributes [String] :handled_word The handled word by the service. Required.
|
21
21
|
# @return [Inflect::Response]
|
22
|
-
def initialize(content=nil,
|
22
|
+
def initialize(content=nil, attributes={})
|
23
23
|
@content = content
|
24
24
|
@timestamp = Time.now
|
25
25
|
@errors = {}
|
26
|
-
@attributes =
|
26
|
+
@attributes = attributes
|
27
27
|
end
|
28
28
|
|
29
29
|
# Keys of the required attributes.
|
@@ -59,14 +59,5 @@ module Inflect
|
|
59
59
|
end
|
60
60
|
true
|
61
61
|
end
|
62
|
-
|
63
|
-
def extract_attributes(description={})
|
64
|
-
attributes = {}
|
65
|
-
|
66
|
-
self.class.attribute_keys.each do |key|
|
67
|
-
attributes.store key, description[key]
|
68
|
-
end
|
69
|
-
attributes
|
70
|
-
end
|
71
62
|
end
|
72
63
|
end
|
data/lib/inflect/responsive.rb
CHANGED
@@ -9,7 +9,7 @@ module Inflect
|
|
9
9
|
def serve(words)
|
10
10
|
content, options = handle(words)
|
11
11
|
opts = merge_options(options, { query_words: words })
|
12
|
-
validate_response(Inflect::Response.new(content, opts))
|
12
|
+
response = validate_response(Inflect::Response.new(content, opts))
|
13
13
|
end
|
14
14
|
|
15
15
|
# Supply more expressiveness and flexibility to the interface
|
@@ -20,7 +20,7 @@ module Inflect
|
|
20
20
|
# respond 'String Response', opt: 'Extra options'
|
21
21
|
# @example Or as a Hash with options
|
22
22
|
# respond({content: 'Hashed Response'}, {opt: 'Extra options'})
|
23
|
-
def respond(content, options= {})
|
23
|
+
def respond(content, options = {})
|
24
24
|
[content, options]
|
25
25
|
end
|
26
26
|
|
data/lib/inflect/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inflect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Santiago Figueiras
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -134,9 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.1
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Backend service API support for the inflect-client app.
|
141
141
|
test_files: []
|
142
|
-
has_rdoc:
|