insuggest 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/insuggest/tp_vendor.rb +46 -0
- data/lib/insuggest/travel.rb +48 -0
- data/lib/insuggest/version.rb +1 -1
- data/lib/insuggest.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a6ba7f9ebecbb03ce2a0cb438c32448e4c84e9
|
4
|
+
data.tar.gz: cd7ffa8975aab0da2759ae1f007d9e8f78f213d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6830739c739c5fe7d228a916d54f9e9886c7a106a45310e553c3fc452bc1b661d5860164e85a17750194a0679c3523e5506b1c5545125e673ffc1986d97b365c
|
7
|
+
data.tar.gz: ca60da5afb033001a9b6701b6303a92ffc3882a305a9b53c7c8b770a86958dfb518295e9a30524e1ecba0700cd93c94a01127e1953d4079a446846396183149a
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Insuggest
|
2
|
+
module TpVendor
|
3
|
+
attr_reader :attributes
|
4
|
+
|
5
|
+
def initialize(attributes={})
|
6
|
+
@attributes = attributes
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_hash
|
10
|
+
@attributes
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
|
15
|
+
def get_index_name
|
16
|
+
"tp_vendors"
|
17
|
+
end
|
18
|
+
|
19
|
+
def repository
|
20
|
+
index_name = get_index_name
|
21
|
+
Elasticsearch::Persistence::Repository.new do
|
22
|
+
index index_name
|
23
|
+
type :tp_vendor
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def search(query=[], size= 100)
|
28
|
+
self.repository.search({
|
29
|
+
size: size,
|
30
|
+
query: {
|
31
|
+
bool: {
|
32
|
+
must: [
|
33
|
+
{ match: { category: query[0] } },
|
34
|
+
{ match: { sub_category: query[1] } },
|
35
|
+
]
|
36
|
+
}
|
37
|
+
}
|
38
|
+
})[0]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.included(base)
|
43
|
+
base.extend(ClassMethods)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Insuggest
|
2
|
+
module Travel
|
3
|
+
attr_reader :attributes
|
4
|
+
|
5
|
+
def initialize(attributes={})
|
6
|
+
@attributes = attributes
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_hash
|
10
|
+
@attributes
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
|
15
|
+
def get_index_name
|
16
|
+
"travels"
|
17
|
+
end
|
18
|
+
|
19
|
+
def repository
|
20
|
+
index_name = get_index_name
|
21
|
+
Elasticsearch::Persistence::Repository.new do
|
22
|
+
index index_name
|
23
|
+
type :travel
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def search(days, cover, age, size=100)
|
28
|
+
self.repository.search({
|
29
|
+
size: size,
|
30
|
+
query: {
|
31
|
+
bool: {
|
32
|
+
must: [
|
33
|
+
{ match: { days: days } },
|
34
|
+
{ match: { cover: cover } },
|
35
|
+
{ range: { from: { lte: age } } },
|
36
|
+
{ range: { to: { gte: age } } }
|
37
|
+
]
|
38
|
+
}
|
39
|
+
}
|
40
|
+
})
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.included(base)
|
45
|
+
base.extend(ClassMethods)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/insuggest/version.rb
CHANGED
data/lib/insuggest.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insuggest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shailesh Patil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|
@@ -114,6 +114,8 @@ files:
|
|
114
114
|
- lib/insuggest/gcv/depreciation.rb
|
115
115
|
- lib/insuggest/gcv/discount.rb
|
116
116
|
- lib/insuggest/idv.rb
|
117
|
+
- lib/insuggest/tp_vendor.rb
|
118
|
+
- lib/insuggest/travel.rb
|
117
119
|
- lib/insuggest/version.rb
|
118
120
|
homepage: ''
|
119
121
|
licenses:
|