CloudSesame 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +22 -6
- data/cloud_sesame.gemspec +3 -2
- data/lib/cloud_sesame.rb +5 -5
- data/lib/cloud_sesame/context.rb +34 -0
- data/lib/cloud_sesame/domain/base.rb +40 -30
- data/lib/cloud_sesame/domain/context.rb +29 -29
- data/lib/cloud_sesame/query/ast/literal.rb +10 -5
- data/lib/cloud_sesame/query/ast/single_expression_operator.rb +2 -2
- data/lib/cloud_sesame/query/builder.rb +3 -3
- data/lib/cloud_sesame/query/dsl/field_array_methods.rb +1 -1
- data/lib/cloud_sesame/query/dsl/field_methods.rb +3 -13
- data/lib/cloud_sesame/query/node/facet.rb +1 -1
- data/lib/cloud_sesame/query/node/request.rb +8 -8
- data/spec/cloud_sesame/query/node/facet_spec.rb +3 -4
- data/spec/cloud_sesame_spec.rb +25 -25
- data/spec/context_spec.rb +17 -0
- metadata +35 -20
- data/spec/cloud_sesame/domain/context_spec.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38932c184fc0a22bb899a645b63bc7d3b1800b9f
|
4
|
+
data.tar.gz: 9bb022f324c951547374ac0dbea2e90ba20208fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977d4661346efb23226ac794f5774463279c82057a7c67c1069bf2ebc1a554619d319184b0ffdb3a79395395bb1a39ecf9db0e762f6a394d99fdf434df431afa
|
7
|
+
data.tar.gz: bcd8037e3577cc9d65b0bf276da30c658aaeab233b9b224e3aa9011493541b1178eba3503893ce5265d033ecdf06e3302850e7730f6359c371abcbfb6ebf9d8d
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
CloudSesame (0.4.
|
4
|
+
CloudSesame (0.4.3)
|
5
|
+
activesupport
|
5
6
|
aws-sdk (~> 2)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
activesupport (4.2.5)
|
12
|
+
i18n (~> 0.7)
|
13
|
+
json (~> 1.7, >= 1.7.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
aws-sdk (2.2.13)
|
18
|
+
aws-sdk-resources (= 2.2.13)
|
19
|
+
aws-sdk-core (2.2.13)
|
13
20
|
jmespath (~> 1.0)
|
14
|
-
aws-sdk-resources (2.2.
|
15
|
-
aws-sdk-core (= 2.2.
|
21
|
+
aws-sdk-resources (2.2.13)
|
22
|
+
aws-sdk-core (= 2.2.13)
|
16
23
|
coderay (1.1.0)
|
17
24
|
diff-lcs (1.2.5)
|
18
25
|
ffi (1.9.10)
|
@@ -31,12 +38,15 @@ GEM
|
|
31
38
|
guard (~> 2.1)
|
32
39
|
guard-compat (~> 1.1)
|
33
40
|
rspec (>= 2.99.0, < 4.0)
|
41
|
+
i18n (0.7.0)
|
34
42
|
jmespath (1.1.3)
|
43
|
+
json (1.8.3)
|
35
44
|
listen (3.0.5)
|
36
45
|
rb-fsevent (>= 0.9.3)
|
37
46
|
rb-inotify (>= 0.9)
|
38
47
|
lumberjack (1.0.10)
|
39
48
|
method_source (0.8.2)
|
49
|
+
minitest (5.8.4)
|
40
50
|
nenv (0.2.0)
|
41
51
|
notiffany (0.0.8)
|
42
52
|
nenv (~> 0.1)
|
@@ -65,6 +75,9 @@ GEM
|
|
65
75
|
shellany (0.0.1)
|
66
76
|
slop (3.6.0)
|
67
77
|
thor (0.19.1)
|
78
|
+
thread_safe (0.3.5)
|
79
|
+
tzinfo (1.2.2)
|
80
|
+
thread_safe (~> 0.1)
|
68
81
|
|
69
82
|
PLATFORMS
|
70
83
|
ruby
|
@@ -76,3 +89,6 @@ DEPENDENCIES
|
|
76
89
|
pry (~> 0)
|
77
90
|
rspec (~> 3)
|
78
91
|
ruby-prof
|
92
|
+
|
93
|
+
BUNDLED WITH
|
94
|
+
1.11.2
|
data/cloud_sesame.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'CloudSesame'
|
3
|
-
s.version = '0.4.
|
3
|
+
s.version = '0.4.3'
|
4
4
|
s.date = '2016-01-20'
|
5
5
|
s.summary = "AWS CloudSearch Query DSL"
|
6
6
|
s.description = "AWS CloudSearch Query DSL"
|
@@ -16,7 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
17
17
|
s.require_paths = ['lib']
|
18
18
|
|
19
|
-
s.add_dependency
|
19
|
+
s.add_dependency 'aws-sdk', '~> 2'
|
20
|
+
s.add_dependency 'activesupport'
|
20
21
|
|
21
22
|
s.add_development_dependency 'rspec', '~> 3'
|
22
23
|
s.add_development_dependency 'pry', '~> 0'
|
data/lib/cloud_sesame.rb
CHANGED
@@ -72,10 +72,10 @@ require 'cloud_sesame/query/builder'
|
|
72
72
|
|
73
73
|
# Domain Objects
|
74
74
|
# ===============================================
|
75
|
+
require 'cloud_sesame/context'
|
75
76
|
require 'cloud_sesame/domain/base'
|
76
77
|
require 'cloud_sesame/domain/client'
|
77
78
|
require 'cloud_sesame/domain/config'
|
78
|
-
require 'cloud_sesame/domain/context'
|
79
79
|
|
80
80
|
# Public Interface
|
81
81
|
# ===============================================
|
@@ -88,19 +88,19 @@ module CloudSesame
|
|
88
88
|
module ClassMethods
|
89
89
|
|
90
90
|
def cloudsearch
|
91
|
-
@cloudsearch ||=
|
91
|
+
@cloudsearch ||= Domain::Base.new self
|
92
92
|
end
|
93
93
|
|
94
94
|
def define_cloudsearch(&block)
|
95
95
|
if block_given?
|
96
|
-
|
96
|
+
Domain::Base::DEFINITIONS[self] = block
|
97
97
|
cloudsearch.instance_eval &block
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
def load_definition_from(klass)
|
102
|
-
if
|
103
|
-
cloudsearch.instance_eval &
|
102
|
+
if (definition = Domain::Base::DEFINITIONS[self])
|
103
|
+
cloudsearch.instance_eval &definition
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'active_support/core_ext/object/deep_dup'
|
2
|
+
|
3
|
+
module CloudSesame
|
4
|
+
class Context
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :table, :each,
|
8
|
+
:map,
|
9
|
+
:delete,
|
10
|
+
:select,
|
11
|
+
:include?,
|
12
|
+
:empty?
|
13
|
+
|
14
|
+
attr_reader :table
|
15
|
+
|
16
|
+
def initialize(hash = {})
|
17
|
+
@table = hash
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](key, default = nil)
|
21
|
+
(result = table[key.to_sym]) ? result : default ? table[key.to_sym] = default : nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def []=(key, value)
|
25
|
+
table[key.to_sym] = value
|
26
|
+
end
|
27
|
+
|
28
|
+
def duplicate(context)
|
29
|
+
@table = context.table.deep_dup
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -3,17 +3,18 @@ module CloudSesame
|
|
3
3
|
class Base
|
4
4
|
extend Forwardable
|
5
5
|
|
6
|
-
attr_accessor :definition
|
7
6
|
attr_reader :searchable, :result
|
8
7
|
|
9
8
|
def_delegator :client, :config
|
10
9
|
|
10
|
+
DEFINITIONS = {}
|
11
|
+
|
11
12
|
def initialize(searchable)
|
12
13
|
@searchable = searchable
|
13
14
|
end
|
14
15
|
|
15
16
|
def builder
|
16
|
-
Query::Builder.new
|
17
|
+
Query::Builder.new context, searchable
|
17
18
|
end
|
18
19
|
|
19
20
|
def client
|
@@ -26,25 +27,25 @@ module CloudSesame
|
|
26
27
|
|
27
28
|
# DEFAULT CONTEXT METHODS
|
28
29
|
# =========================================
|
29
|
-
|
30
30
|
def default_size(value)
|
31
|
-
context[:page
|
31
|
+
(context[:page] ||= {})[:size] = value
|
32
32
|
end
|
33
33
|
|
34
34
|
def field(name, options = {})
|
35
|
-
field_name = (options[:as] || name)
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
field_name = (options[:as] || name)
|
36
|
+
add_query field_name, options.delete(:query)
|
37
|
+
add_facet field_name, options.delete(:facet)
|
38
|
+
|
39
|
+
add_field_expression name.to_sym, options
|
39
40
|
end
|
40
41
|
|
41
42
|
def define_sloppiness(value)
|
42
|
-
context[:query
|
43
|
+
(context[:query] ||= {})[:sloppiness] = value.to_i
|
43
44
|
end
|
44
45
|
|
45
46
|
def define_fuzziness(proc = nil, &block)
|
46
47
|
block = proc unless block_given?
|
47
|
-
context[:query
|
48
|
+
(context[:query] ||= {})[:fuzziness] = Query::Node::Fuzziness.new(&block)
|
48
49
|
end
|
49
50
|
|
50
51
|
def default_scope(proc, &block)
|
@@ -53,42 +54,51 @@ module CloudSesame
|
|
53
54
|
|
54
55
|
def scope(name, proc = nil, &block)
|
55
56
|
block = proc unless block_given?
|
56
|
-
context[:filter_query
|
57
|
+
((context[:filter_query] ||= {})[:scopes] ||= {})[name.to_sym] = block
|
57
58
|
end
|
58
59
|
|
59
60
|
private
|
60
61
|
|
61
|
-
def
|
62
|
+
def ensure_hash(options)
|
62
63
|
options.is_a?(Hash) ? options : {}
|
63
64
|
end
|
64
65
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
66
|
+
def add_query(name, options)
|
67
|
+
((context[:query_options] ||= {})[:fields] ||= {})[name] = ensure_hash(options) if options
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_facet(name, options)
|
71
|
+
(context[:facet] ||= {})[name] = ensure_hash(options) if options
|
72
|
+
end
|
73
|
+
|
74
|
+
def add_field_expression(name, options)
|
75
|
+
overriding_field_expression name, options
|
76
|
+
create_default_field_expression name, options
|
77
|
+
create_field_expression_writer name, options
|
73
78
|
end
|
74
79
|
|
75
|
-
def
|
76
|
-
context[:
|
80
|
+
def overriding_field_expression(name, options)
|
81
|
+
fields = ((context[:filter_query] ||= {})[:fields] ||= {})
|
82
|
+
if (as = options[:as]) && (existing = fields.delete(as))
|
83
|
+
options.merge! existing
|
84
|
+
end
|
77
85
|
end
|
78
86
|
|
79
|
-
def
|
80
|
-
|
87
|
+
def create_default_field_expression(name, options)
|
88
|
+
if (block = options.delete(:default))
|
89
|
+
(context[:filter_query][:default] ||= []) << block
|
90
|
+
end
|
81
91
|
end
|
82
92
|
|
83
|
-
def
|
84
|
-
context[:filter_query
|
93
|
+
def create_field_expression_writer(name, options)
|
94
|
+
(context[:filter_query][:fields] ||= {})[name] = options
|
95
|
+
Query::DSL::FieldMethods.send(:define_method, name) do |*values|
|
96
|
+
literal name, *values
|
97
|
+
end
|
85
98
|
end
|
86
99
|
|
87
100
|
def method_missing(name, *args, &block)
|
88
|
-
|
89
|
-
b.send(name, *args, &block)
|
90
|
-
rescue NoMethodError
|
91
|
-
super
|
101
|
+
builder.send(name, *args, &block) rescue super
|
92
102
|
end
|
93
103
|
|
94
104
|
end
|
@@ -1,39 +1,39 @@
|
|
1
|
-
module CloudSesame
|
2
|
-
|
3
|
-
|
1
|
+
# module CloudSesame
|
2
|
+
# module Domain
|
3
|
+
# class Context
|
4
4
|
|
5
|
-
|
5
|
+
# attr_reader :table
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
# def initialize(table = {})
|
8
|
+
# @table = table
|
9
|
+
# end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
# def [](key, find_or_create = false)
|
12
|
+
# table[key] ||= default_value(find_or_create)
|
13
|
+
# end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
# def []=(key, value)
|
16
|
+
# table[key] = value
|
17
|
+
# end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
# def delete(key)
|
20
|
+
# table.delete key
|
21
|
+
# end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
# def each(&block)
|
24
|
+
# table.each &block
|
25
|
+
# end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
# def map(&block)
|
28
|
+
# table.map &block
|
29
|
+
# end
|
30
30
|
|
31
|
-
|
31
|
+
# private
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
# def default_value(data)
|
34
|
+
# data != true ? data : Context.new if data
|
35
|
+
# end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
end
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
# end
|
@@ -9,19 +9,24 @@ module CloudSesame
|
|
9
9
|
attr_accessor :field
|
10
10
|
attr_reader :options, :value
|
11
11
|
|
12
|
-
def initialize(field
|
12
|
+
def initialize(field, value, options = {}, &block)
|
13
13
|
@field = field
|
14
14
|
@value = Value.parse value if value
|
15
|
-
@value = Value.parse
|
16
|
-
|
17
|
-
|
15
|
+
@value = Value.parse(ValueEvaluator.new.instance_exec &block) if block_given?
|
16
|
+
|
17
|
+
@options = options
|
18
|
+
is_included
|
18
19
|
end
|
19
20
|
|
20
|
-
def is_for(field, options)
|
21
|
+
def is_for(field, options = {})
|
21
22
|
@field = field
|
22
23
|
@options = options.merge @options
|
23
24
|
end
|
24
25
|
|
26
|
+
def is_included
|
27
|
+
applied[value] = true
|
28
|
+
end
|
29
|
+
|
25
30
|
def is_excluded
|
26
31
|
applied[value] = applied[value] == false ? true : false
|
27
32
|
end
|
@@ -15,13 +15,13 @@ module CloudSesame
|
|
15
15
|
|
16
16
|
attr_reader :context, :searchable, :result
|
17
17
|
|
18
|
-
def initialize(
|
19
|
-
@context =
|
18
|
+
def initialize(context, searchable)
|
19
|
+
@context = Context.new.duplicate context
|
20
20
|
@searchable = searchable
|
21
21
|
end
|
22
22
|
|
23
23
|
def request
|
24
|
-
@request ||= Node::Request.new
|
24
|
+
@request ||= Node::Request.new context
|
25
25
|
end
|
26
26
|
|
27
27
|
def response
|
@@ -5,19 +5,9 @@ module CloudSesame
|
|
5
5
|
|
6
6
|
def literal(name, *values)
|
7
7
|
name = name.to_sym
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
dsl_scope.children.insert values
|
12
|
-
else
|
13
|
-
false
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def method_missing(name, *values, &block)
|
20
|
-
(result = literal(name, *values)) ? result : super
|
8
|
+
dsl_scope.children.field = name
|
9
|
+
dsl_scope.children.dsl_return = dsl_return
|
10
|
+
dsl_scope.children.insert values
|
21
11
|
end
|
22
12
|
|
23
13
|
end
|
@@ -7,35 +7,35 @@ module CloudSesame
|
|
7
7
|
# =========================================
|
8
8
|
|
9
9
|
def query
|
10
|
-
@query ||= Query.new(context[:query
|
10
|
+
@query ||= Query.new(context[:query] ||= {})
|
11
11
|
end
|
12
12
|
|
13
13
|
def query_options
|
14
|
-
@query_options ||= QueryOptions.new(context[:query_options
|
14
|
+
@query_options ||= QueryOptions.new(context[:query_options] ||= {})
|
15
15
|
end
|
16
16
|
|
17
17
|
def query_parser
|
18
|
-
@query_parser ||= QueryParser.new(context[:query_parser
|
18
|
+
@query_parser ||= QueryParser.new(context[:query_parser] ||= {})
|
19
19
|
end
|
20
20
|
|
21
21
|
def filter_query
|
22
|
-
@filter_query ||= FilterQuery.new(context[:filter_query
|
22
|
+
@filter_query ||= FilterQuery.new(context[:filter_query] ||= {})
|
23
23
|
end
|
24
24
|
|
25
25
|
def facet
|
26
|
-
@facet ||= Facet.new(context[:facet
|
26
|
+
@facet ||= Facet.new(context[:facet] ||= {})
|
27
27
|
end
|
28
28
|
|
29
29
|
def page
|
30
|
-
@page ||= Page.new(context[:page
|
30
|
+
@page ||= Page.new(context[:page] ||= {})
|
31
31
|
end
|
32
32
|
|
33
33
|
def sort
|
34
|
-
@sort ||= Sort.new(context[:sort
|
34
|
+
@sort ||= Sort.new(context[:sort] ||= {})
|
35
35
|
end
|
36
36
|
|
37
37
|
def return_field
|
38
|
-
@return ||= Return.new(context[:return
|
38
|
+
@return ||= Return.new(context[:return] ||= {})
|
39
39
|
end
|
40
40
|
|
41
41
|
# EVALUATION
|
@@ -4,19 +4,18 @@ module CloudSesame
|
|
4
4
|
module Query
|
5
5
|
module Node
|
6
6
|
describe Facet do
|
7
|
-
let(:facet) { Facet.new(
|
8
|
-
let(:context) { Domain::Context.new(facet_options) }
|
7
|
+
let(:facet) { Facet.new(facet_options) }
|
9
8
|
describe '#facet' do
|
10
9
|
context 'when default facet is defined' do
|
11
10
|
let(:facet_options) { { price: { size: 100 } } }
|
12
11
|
it 'should return the default facet options' do
|
13
|
-
expect(
|
12
|
+
expect(facet_options).to include(facet_options)
|
14
13
|
end
|
15
14
|
end
|
16
15
|
context 'when default facet is not defined' do
|
17
16
|
let(:facet_options) { {} }
|
18
17
|
it 'should return an empty facet options' do
|
19
|
-
expect(
|
18
|
+
expect(facet_options).to include(facet_options)
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
data/spec/cloud_sesame_spec.rb
CHANGED
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
# field :searchable_text, query: { weight: 2 }
|
44
44
|
# field :description, query: true
|
45
|
-
# field :tags
|
45
|
+
# field :tags, as: :text1
|
46
46
|
|
47
47
|
# field :affiliate_advertiser_ext_id, facet: { size: 50 }
|
48
48
|
# field :currency, facet: true
|
@@ -68,32 +68,32 @@
|
|
68
68
|
# n.times do
|
69
69
|
# q = Product.cloudsearch.query("black jacket").sort(price: :asc).page(1).size(1000).and {
|
70
70
|
# or! {
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
# }
|
71
|
+
# tags "1", "2"
|
72
|
+
# and! {
|
73
|
+
# tags.not "3", "4"
|
74
|
+
# }
|
75
|
+
# and!.not {
|
76
|
+
# tags.start_with "5", "6"
|
77
|
+
# tags.not.start_with "7"
|
78
|
+
# tags.not.near "8"
|
79
|
+
# tags start_with("9"), near("10")
|
80
|
+
# tags term "11"
|
81
|
+
# tags phrase "12"
|
82
|
+
# }
|
83
|
+
# or!.not {
|
84
|
+
# price 25..100
|
85
|
+
# price 100...200
|
86
|
+
# price gte(200).lt(300)
|
87
|
+
# price gte(300)
|
88
|
+
# }
|
89
|
+
# or! {
|
90
|
+
# created_at Date.today - 7
|
91
|
+
# created_at gte(Date.today)
|
92
|
+
# created_at gte(Date.today).lt(Date.today + 3)
|
94
93
|
# }
|
95
94
|
# }
|
96
|
-
#
|
95
|
+
# }
|
96
|
+
# q.applied_filters
|
97
97
|
|
98
98
|
# end
|
99
99
|
# end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CloudSesame
|
4
|
+
describe Context do
|
5
|
+
|
6
|
+
describe '#initialize' do
|
7
|
+
it 'should set default value to nil' do
|
8
|
+
expect(subject.table).to eq({})
|
9
|
+
end
|
10
|
+
it 'should accept an default value' do
|
11
|
+
context = Context.new(:default_value)
|
12
|
+
expect(context.table).to eq(:default_value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CloudSesame
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Chu
|
@@ -21,84 +21,98 @@ dependencies:
|
|
21
21
|
name: aws-sdk
|
22
22
|
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2'
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: activesupport
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
34
48
|
- !ruby/object:Gem::Dependency
|
35
49
|
name: rspec
|
36
50
|
requirement: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - ~>
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '3'
|
41
55
|
type: :development
|
42
56
|
prerelease: false
|
43
57
|
version_requirements: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - ~>
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '3'
|
48
62
|
- !ruby/object:Gem::Dependency
|
49
63
|
name: pry
|
50
64
|
requirement: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - ~>
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
type: :development
|
56
70
|
prerelease: false
|
57
71
|
version_requirements: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
- !ruby/object:Gem::Dependency
|
63
77
|
name: guard
|
64
78
|
requirement: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
type: :development
|
70
84
|
prerelease: false
|
71
85
|
version_requirements: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
- !ruby/object:Gem::Dependency
|
77
91
|
name: guard-rspec
|
78
92
|
requirement: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
type: :development
|
84
98
|
prerelease: false
|
85
99
|
version_requirements: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
- !ruby/object:Gem::Dependency
|
91
105
|
name: ruby-prof
|
92
106
|
requirement: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
type: :development
|
98
112
|
prerelease: false
|
99
113
|
version_requirements: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
description: AWS CloudSearch Query DSL
|
@@ -107,8 +121,8 @@ executables: []
|
|
107
121
|
extensions: []
|
108
122
|
extra_rdoc_files: []
|
109
123
|
files:
|
110
|
-
- .gitignore
|
111
|
-
- .rspec
|
124
|
+
- ".gitignore"
|
125
|
+
- ".rspec"
|
112
126
|
- Gemfile
|
113
127
|
- Gemfile.lock
|
114
128
|
- Guardfile
|
@@ -117,6 +131,7 @@ files:
|
|
117
131
|
- lib/abstract_object.rb
|
118
132
|
- lib/cloud_sesame.rb
|
119
133
|
- lib/cloud_sesame/config/credential.rb
|
134
|
+
- lib/cloud_sesame/context.rb
|
120
135
|
- lib/cloud_sesame/domain/base.rb
|
121
136
|
- lib/cloud_sesame/domain/client.rb
|
122
137
|
- lib/cloud_sesame/domain/config.rb
|
@@ -171,7 +186,6 @@ files:
|
|
171
186
|
- profiler.rb
|
172
187
|
- spec/abstract_object_spec.rb
|
173
188
|
- spec/cloud_sesame/domain/base_spec.rb
|
174
|
-
- spec/cloud_sesame/domain/context_spec.rb
|
175
189
|
- spec/cloud_sesame/query/ast/and_spec.rb
|
176
190
|
- spec/cloud_sesame/query/ast/block_chaining_relation_spec.rb
|
177
191
|
- spec/cloud_sesame/query/ast/multi_expression_operator_spec.rb
|
@@ -196,6 +210,7 @@ files:
|
|
196
210
|
- spec/cloud_sesame/query/node/query_spec.rb
|
197
211
|
- spec/cloud_sesame/query/node/sort_spec.rb
|
198
212
|
- spec/cloud_sesame_spec.rb
|
213
|
+
- spec/context_spec.rb
|
199
214
|
- spec/spec_helper.rb
|
200
215
|
homepage: https://github.com/47colborne/cloud-sesame
|
201
216
|
licenses:
|
@@ -207,24 +222,23 @@ require_paths:
|
|
207
222
|
- lib
|
208
223
|
required_ruby_version: !ruby/object:Gem::Requirement
|
209
224
|
requirements:
|
210
|
-
- -
|
225
|
+
- - ">="
|
211
226
|
- !ruby/object:Gem::Version
|
212
227
|
version: '0'
|
213
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
229
|
requirements:
|
215
|
-
- -
|
230
|
+
- - ">="
|
216
231
|
- !ruby/object:Gem::Version
|
217
232
|
version: '0'
|
218
233
|
requirements: []
|
219
234
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.
|
235
|
+
rubygems_version: 2.5.1
|
221
236
|
signing_key:
|
222
237
|
specification_version: 4
|
223
238
|
summary: AWS CloudSearch Query DSL
|
224
239
|
test_files:
|
225
240
|
- spec/abstract_object_spec.rb
|
226
241
|
- spec/cloud_sesame/domain/base_spec.rb
|
227
|
-
- spec/cloud_sesame/domain/context_spec.rb
|
228
242
|
- spec/cloud_sesame/query/ast/and_spec.rb
|
229
243
|
- spec/cloud_sesame/query/ast/block_chaining_relation_spec.rb
|
230
244
|
- spec/cloud_sesame/query/ast/multi_expression_operator_spec.rb
|
@@ -249,4 +263,5 @@ test_files:
|
|
249
263
|
- spec/cloud_sesame/query/node/query_spec.rb
|
250
264
|
- spec/cloud_sesame/query/node/sort_spec.rb
|
251
265
|
- spec/cloud_sesame_spec.rb
|
266
|
+
- spec/context_spec.rb
|
252
267
|
- spec/spec_helper.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module CloudSesame
|
4
|
-
module Domain
|
5
|
-
describe Context do
|
6
|
-
|
7
|
-
describe '#initialize' do
|
8
|
-
it 'should set default value to nil' do
|
9
|
-
expect(subject.table).to eq({})
|
10
|
-
end
|
11
|
-
it 'should accept an default value' do
|
12
|
-
context = Context.new(:default_value)
|
13
|
-
expect(context.table).to eq(:default_value)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '#[]' do
|
18
|
-
# it 'should return an '
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|