insuggest 0.0.6 → 0.0.8

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
  SHA1:
3
- metadata.gz: 46a33dca4a0b7b50345f26977fd8557823eb0213
4
- data.tar.gz: 1006546ef44721eb9af49ed302ccc34943316015
3
+ metadata.gz: b9a6ba7f9ebecbb03ce2a0cb438c32448e4c84e9
4
+ data.tar.gz: cd7ffa8975aab0da2759ae1f007d9e8f78f213d0
5
5
  SHA512:
6
- metadata.gz: d7a7e19878c3a65dca622ed135c0ca4f315811082103916fd6820dce52c1a15ac064aea2568b80154968a5cbc91280ea5732814e2f8ae1c31bc29d8e8b6b7034
7
- data.tar.gz: 19615b4f0383f820f6cc06cc0c40b5cd70935158b61ec6945c74987ee07ce82ee774fe97540968972a4e7e23baee6888fdd423ff7aeddd11887eb88ee4f88893
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
@@ -1,3 +1,3 @@
1
1
  module Insuggest
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/insuggest.rb CHANGED
@@ -5,5 +5,7 @@ require "insuggest/discount"
5
5
  require "insuggest/depreciation"
6
6
  require "insuggest/gcv/discount"
7
7
  require "insuggest/gcv/depreciation"
8
+ require "insuggest/travel"
9
+ require "insuggest/tp_vendor"
8
10
  require "insuggest/idv"
9
11
  require "insuggest/version"
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.6
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: 2015-12-24 00:00:00.000000000 Z
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: