insuggest 0.0.8 → 0.0.9

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: b9a6ba7f9ebecbb03ce2a0cb438c32448e4c84e9
4
- data.tar.gz: cd7ffa8975aab0da2759ae1f007d9e8f78f213d0
3
+ metadata.gz: ffa367aa57c64d3b1aba8e9e60032f19addc70f7
4
+ data.tar.gz: d168390c20823ac9e4f0bf469233bec18d253c70
5
5
  SHA512:
6
- metadata.gz: 6830739c739c5fe7d228a916d54f9e9886c7a106a45310e553c3fc452bc1b661d5860164e85a17750194a0679c3523e5506b1c5545125e673ffc1986d97b365c
7
- data.tar.gz: ca60da5afb033001a9b6701b6303a92ffc3882a305a9b53c7c8b770a86958dfb518295e9a30524e1ecba0700cd93c94a01127e1953d4079a446846396183149a
6
+ metadata.gz: 6383f3a34499b6ffa8e31393e9a486886f51576a510a6c3e161ae7ebba9feebca76f7da3dab6df4ca0b6afa5e106a58902e75bdf25b7b6c21f7d66b44f257ede
7
+ data.tar.gz: 44dd7229b9bd87ce4617589317a898d656fbc5bf49c82dafc833ed426b044549ea1696f7d62064ed367aab3655e85eb11aff8c52206a93b93d52bbcae26233d5
@@ -0,0 +1,46 @@
1
+ module Insuggest
2
+ module TpDecline
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_declines"
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_decline
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: { make: query[:make] } },
34
+ { match: { model: query[:model] } },
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
@@ -24,14 +24,14 @@ module Insuggest
24
24
  end
25
25
  end
26
26
 
27
- def search(query=[], size= 100)
27
+ def search(query={}, size= 100)
28
28
  self.repository.search({
29
29
  size: size,
30
30
  query: {
31
31
  bool: {
32
32
  must: [
33
- { match: { category: query[0] } },
34
- { match: { sub_category: query[1] } },
33
+ { match: { category: query[:category] } },
34
+ { match: { sub_category: query[:sub_category] } },
35
35
  ]
36
36
  }
37
37
  }
@@ -1,3 +1,3 @@
1
1
  module Insuggest
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/insuggest.rb CHANGED
@@ -7,5 +7,6 @@ require "insuggest/gcv/discount"
7
7
  require "insuggest/gcv/depreciation"
8
8
  require "insuggest/travel"
9
9
  require "insuggest/tp_vendor"
10
+ require "insuggest/tp_decline"
10
11
  require "insuggest/idv"
11
12
  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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shailesh Patil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch
@@ -114,6 +114,7 @@ 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_decline.rb
117
118
  - lib/insuggest/tp_vendor.rb
118
119
  - lib/insuggest/travel.rb
119
120
  - lib/insuggest/version.rb