loquor 1.12.0 → 1.13.0
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 +8 -8
- data/CHANGELOG.md +3 -0
- data/lib/loquor/api_calls/index.rb +4 -4
- data/lib/loquor/version.rb +1 -1
- data/test/api_calls/index_test.rb +9 -4
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                ZmMxOWUyZWYyZjNmODFjOWY1OTUzYWFkNjE2MWEwNzMxZjdkMjQxNQ==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                MTQwODIzNjdlOTI4OTZmNGY2NmMwYjk0NjM3ZWVmNWNhMDk5NjE3Zg==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                YTNiZDk5NGFlOGY4MjVkYWQ1Y2U1NGE4ZTc2MzYyYmVhNzA0NWNmNTE3YTRj
         | 
| 10 | 
            +
                NjI1ZjgyZGE4ZmIyMWI4NTQ0ODBjYzliMmMyZmJjMDQ1ZDkyMmQ5MDA1OTlk
         | 
| 11 | 
            +
                NzA4MWJjOTc2Mzg4ZmVjZGQ4N2FkOTBjY2IyYjNlYTQ2ZWFjYzg=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                YjRhYjJkMTJmYTc4ODI1ZWU5YjNhODcxNTJlOWU4NDU1OTVhNDVjY2Q5YzJh
         | 
| 14 | 
            +
                M2U4M2ZmYjg1Y2EyM2Y3MWU3N2E2MmE2NjM2MjFjZjYzZTc1NGFiYmVjZWQ0
         | 
| 15 | 
            +
                YzVlNGM4ODM5YzI5MmRmN2RiNzI5NDUyMzBiYmNhYTJhNDY5NjY=
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| @@ -90,22 +90,22 @@ module Loquor | |
| 90 90 | 
             
                def add_criteria(query_string, key, value)
         | 
| 91 91 | 
             
                  substitute_value = Loquor.config.substitute_values[value]
         | 
| 92 92 | 
             
                  if !substitute_value.nil?
         | 
| 93 | 
            -
                    query_string << "#{key}=#{URI. | 
| 93 | 
            +
                    query_string << "#{key}=#{URI.encode_www_form_component(substitute_value)}"
         | 
| 94 94 | 
             
                  else
         | 
| 95 95 | 
             
                    case value
         | 
| 96 96 | 
             
                    when String, Symbol, Numeric, Date, Time, DateTime
         | 
| 97 | 
            -
                      query_string << "#{key}=#{URI. | 
| 97 | 
            +
                      query_string << "#{key}=#{URI.encode_www_form_component(value.to_s)}"
         | 
| 98 98 | 
             
                    when Array
         | 
| 99 99 | 
             
                      if value.empty?
         | 
| 100 100 | 
             
                          query_string << "#{key}[]="
         | 
| 101 101 | 
             
                      else
         | 
| 102 102 | 
             
                        value.each do |v|
         | 
| 103 | 
            -
                          query_string << "#{key}[]=#{URI. | 
| 103 | 
            +
                          query_string << "#{key}[]=#{URI.encode_www_form_component(v.to_s)}"
         | 
| 104 104 | 
             
                        end
         | 
| 105 105 | 
             
                      end
         | 
| 106 106 | 
             
                    when Hash
         | 
| 107 107 | 
             
                      value.each do |k,v|
         | 
| 108 | 
            -
                        query_string << "#{key}[#{k}]=#{URI. | 
| 108 | 
            +
                        query_string << "#{key}[#{k}]=#{URI.encode_www_form_component(v.to_s)}"
         | 
| 109 109 | 
             
                      end
         | 
| 110 110 | 
             
                    else
         | 
| 111 111 | 
             
                      raise LoquorError.new("Filter values must be strings, arrays, date, time, datetime or single-depth hashes.")
         | 
    
        data/lib/loquor/version.rb
    CHANGED
    
    
| @@ -82,7 +82,7 @@ module Loquor | |
| 82 82 |  | 
| 83 83 | 
             
                def test_where_gets_correct_url_with_criteria
         | 
| 84 84 | 
             
                  searcher = ApiCall::Index.new(resource).where(name: 'Star Wars')
         | 
| 85 | 
            -
                  assert searcher.send(:generate_url).include? "?name=Star | 
| 85 | 
            +
                  assert searcher.send(:generate_url).include? "?name=Star+Wars"
         | 
| 86 86 | 
             
                end
         | 
| 87 87 |  | 
| 88 88 | 
             
                def test_where_gets_correct_url_with_symbol
         | 
| @@ -90,6 +90,11 @@ module Loquor | |
| 90 90 | 
             
                  assert searcher.send(:generate_url).include? "?name=star"
         | 
| 91 91 | 
             
                end
         | 
| 92 92 |  | 
| 93 | 
            +
                def test_generated_url_encodes_correctly
         | 
| 94 | 
            +
                  searcher = ApiCall::Index.new(resource).where(url: "http://www.example.com/resource.html?foo=bar&_foo=baz&content=Stuff%3A+that%2Fshould+%28be+escaped%29")
         | 
| 95 | 
            +
                  assert searcher.send(:generate_url).include? "?url=http%3A%2F%2Fwww.example.com%2Fresource.html%3Ffoo%3Dbar%26_foo%3Dbaz%26content%3DStuff%253A%2Bthat%252Fshould%2B%2528be%2Bescaped%2529"
         | 
| 96 | 
            +
                end
         | 
| 97 | 
            +
             | 
| 93 98 | 
             
                def test_where_gets_correct_url_with_date
         | 
| 94 99 | 
             
                  searcher = ApiCall::Index.new(resource).where(name: Date.new(1969,5,10))
         | 
| 95 100 | 
             
                  assert searcher.send(:generate_url).include? "?name=1969-05-10"
         | 
| @@ -97,12 +102,12 @@ module Loquor | |
| 97 102 |  | 
| 98 103 | 
             
                def test_where_gets_correct_url_with_time
         | 
| 99 104 | 
             
                  searcher = ApiCall::Index.new(resource).where(name: Time.new(1969,5,10,13,10))
         | 
| 100 | 
            -
                  assert searcher.send(:generate_url).include? "?name=1969-05-10% | 
| 105 | 
            +
                  assert searcher.send(:generate_url).include? "?name=1969-05-10+13%3A10%3A00"
         | 
| 101 106 | 
             
                end
         | 
| 102 107 |  | 
| 103 108 | 
             
                def test_where_gets_correct_url_with_date_time
         | 
| 104 109 | 
             
                  searcher = ApiCall::Index.new(resource).where(name: DateTime.new(1969,5,10,13,10))
         | 
| 105 | 
            -
                  assert searcher.send(:generate_url).include? "?name=1969-05-10T13 | 
| 110 | 
            +
                  assert searcher.send(:generate_url).include? "?name=1969-05-10T13%3A10%3A00%2B00%3A00"
         | 
| 106 111 | 
             
                end
         | 
| 107 112 |  | 
| 108 113 | 
             
                def test_where_gets_correct_url_with_number
         | 
| @@ -150,7 +155,7 @@ module Loquor | |
| 150 155 | 
             
                  searcher = ApiCall::Index.new(resource).where(criteria)
         | 
| 151 156 | 
             
                  searcher.stubs(path: "foobar")
         | 
| 152 157 | 
             
                  url = searcher.send(:generate_url)
         | 
| 153 | 
            -
                  assert url.include?("thing | 
| 158 | 
            +
                  assert url.include?("thing=%3A__true__")
         | 
| 154 159 | 
             
                end
         | 
| 155 160 |  | 
| 156 161 | 
             
                def test_that_iterating_calls_results
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: loquor
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.13.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jeremy Walker
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014-05- | 
| 11 | 
            +
            date: 2014-05-19 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: filum
         |