redd 0.7.1 → 0.7.2
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/redd/clients/base/read.rb +36 -3
- data/lib/redd/objects/subreddit.rb +24 -0
- data/lib/redd/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 72469adb099523bf28cc5d24e451a1662dbd83e5
         | 
| 4 | 
            +
              data.tar.gz: cc3cee620ae503607895c958743aa7ea7106d141
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3cc603ceacd925867753441e49ff737da23f4375b8d92401dc4ef90f7e03f3bec5f23872e166080b27c990c631b2e35864e514940528a1d7a835da986312814b
         | 
| 7 | 
            +
              data.tar.gz: fb869857d619ba1a6484a9eeb16b0630d7b7695aae95e196ccf4a4fd6b2e2087d0b4499f4f31c4698bc7eafd6a88ee6daf995752e08f1806bdd3233569578d69
         | 
| @@ -42,9 +42,9 @@ module Redd | |
| 42 42 | 
             
                    #   fullname.
         | 
| 43 43 | 
             
                    # @option params [String :before Return results before the given
         | 
| 44 44 | 
             
                    #   fullname.
         | 
| 45 | 
            -
                    # @option params [Integer] :count  | 
| 46 | 
            -
                    #    | 
| 47 | 
            -
                    # @option params [1..100] :limit  | 
| 45 | 
            +
                    # @option params [Integer] :count The number of items already seen in
         | 
| 46 | 
            +
                    #   the listing.
         | 
| 47 | 
            +
                    # @option params [1..100] :limit The maximum number of things to
         | 
| 48 48 | 
             
                    #   return.
         | 
| 49 49 | 
             
                    # @option params [:hour, :day, :week, :month, :year, :all] :t The
         | 
| 50 50 | 
             
                    #   time period to consider when sorting.
         | 
| @@ -60,6 +60,39 @@ module Redd | |
| 60 60 | 
             
                        request_object(:get, path, params)
         | 
| 61 61 | 
             
                      end
         | 
| 62 62 | 
             
                    end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                    # Search.
         | 
| 65 | 
            +
                    # @param query [String] The query string.
         | 
| 66 | 
            +
                    # @param subreddit [Objects::Subreddit, String] The subreddit to query.
         | 
| 67 | 
            +
                    # @param params [Hash] A list of params to send with the request.
         | 
| 68 | 
            +
                    # @option params [String] :after Return results after the given
         | 
| 69 | 
            +
                    #   fullname.
         | 
| 70 | 
            +
                    # @option params [String :before Return results before the given
         | 
| 71 | 
            +
                    #   fullname.
         | 
| 72 | 
            +
                    # @option params [Integer] :count The number of items already seen in
         | 
| 73 | 
            +
                    #   the listing.
         | 
| 74 | 
            +
                    # @option params [1..100] :limit The maximum number of things to
         | 
| 75 | 
            +
                    #   return.
         | 
| 76 | 
            +
                    # @option params [:cloudsearch, :lucene, :plain] :syntax The type of
         | 
| 77 | 
            +
                    #   syntax to use.
         | 
| 78 | 
            +
                    # @option params [:relevance, :new, :hot, :top, :comments] :sort The
         | 
| 79 | 
            +
                    #   way to sort the results.
         | 
| 80 | 
            +
                    # @option params [:hour, :day, :week, :month, :year, :all] :t The
         | 
| 81 | 
            +
                    #   time period to consider when sorting.
         | 
| 82 | 
            +
                    #
         | 
| 83 | 
            +
                    # @note The option :t only applies to the top and controversial sorts.
         | 
| 84 | 
            +
                    # @return [Objects::Listing<Objects::Thing>]
         | 
| 85 | 
            +
                    def search(query, subreddit = nil, **params)
         | 
| 86 | 
            +
                      path = "/search.json"
         | 
| 87 | 
            +
                      params[:q] = query
         | 
| 88 | 
            +
                      if subreddit
         | 
| 89 | 
            +
                        params[:restrict_sr] = true
         | 
| 90 | 
            +
                        srname = property(subreddit, :display_name)
         | 
| 91 | 
            +
                        path = path.prepend("/r/#{srname}")
         | 
| 92 | 
            +
                      end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                      request_object(:get, path, params)
         | 
| 95 | 
            +
                    end
         | 
| 63 96 | 
             
                  end
         | 
| 64 97 | 
             
                end
         | 
| 65 98 | 
             
              end
         | 
| @@ -148,6 +148,30 @@ module Redd | |
| 148 148 | 
             
                    end
         | 
| 149 149 | 
             
                  end
         | 
| 150 150 |  | 
| 151 | 
            +
                  # Search.
         | 
| 152 | 
            +
                  # @param query [String] The query string.
         | 
| 153 | 
            +
                  # @param params [Hash] A list of params to send with the request.
         | 
| 154 | 
            +
                  # @option params [String] :after Return results after the given
         | 
| 155 | 
            +
                  #   fullname.
         | 
| 156 | 
            +
                  # @option params [String :before Return results before the given
         | 
| 157 | 
            +
                  #   fullname.
         | 
| 158 | 
            +
                  # @option params [Integer] :count The number of items already seen in
         | 
| 159 | 
            +
                  #   the listing.
         | 
| 160 | 
            +
                  # @option params [1..100] :limit The maximum number of things to
         | 
| 161 | 
            +
                  #   return.
         | 
| 162 | 
            +
                  # @option params [:cloudsearch, :lucene, :plain] :syntax The type of
         | 
| 163 | 
            +
                  #   syntax to use.
         | 
| 164 | 
            +
                  # @option params [:relevance, :new, :hot, :top, :comments] :sort The
         | 
| 165 | 
            +
                  #   way to sort the results.
         | 
| 166 | 
            +
                  # @option params [:hour, :day, :week, :month, :year, :all] :t The
         | 
| 167 | 
            +
                  #   time period to consider when sorting.
         | 
| 168 | 
            +
                  #
         | 
| 169 | 
            +
                  # @note The option :t only applies to the top and controversial sorts.
         | 
| 170 | 
            +
                  # @return [Objects::Listing<Objects::Thing>]
         | 
| 171 | 
            +
                  def search(query, **params)
         | 
| 172 | 
            +
                    client.search(query, self, **params)
         | 
| 173 | 
            +
                  end
         | 
| 174 | 
            +
             | 
| 151 175 | 
             
                  # @!method get_reports(**params)
         | 
| 152 176 | 
             
                  # @!method get_spam(**params)
         | 
| 153 177 | 
             
                  # @!method get_modqueue(**params)
         | 
    
        data/lib/redd/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: redd
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.7. | 
| 4 | 
            +
              version: 0.7.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Avinash Dwarapu
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-02- | 
| 11 | 
            +
            date: 2015-02-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |