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 +4 -4
 - data/lib/insuggest/tp_decline.rb +46 -0
 - data/lib/insuggest/tp_vendor.rb +3 -3
 - data/lib/insuggest/version.rb +1 -1
 - data/lib/insuggest.rb +1 -0
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ffa367aa57c64d3b1aba8e9e60032f19addc70f7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d168390c20823ac9e4f0bf469233bec18d253c70
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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
         
     | 
    
        data/lib/insuggest/tp_vendor.rb
    CHANGED
    
    | 
         @@ -24,14 +24,14 @@ module Insuggest 
     | 
|
| 
       24 
24 
     | 
    
         
             
                    end
         
     | 
| 
       25 
25 
     | 
    
         
             
                  end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
                  def search(query= 
     | 
| 
      
 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[ 
     | 
| 
       34 
     | 
    
         
            -
                            { match: { sub_category: query[ 
     | 
| 
      
 33 
     | 
    
         
            +
                            { match: { category: query[:category] } },
         
     | 
| 
      
 34 
     | 
    
         
            +
                            { match: { sub_category: query[:sub_category] } },
         
     | 
| 
       35 
35 
     | 
    
         
             
                          ]
         
     | 
| 
       36 
36 
     | 
    
         
             
                        }
         
     | 
| 
       37 
37 
     | 
    
         
             
                      }
         
     | 
    
        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.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- 
     | 
| 
      
 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
         
     |