googl 0.4.2 → 0.4.3
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.
- data/VERSION +1 -1
- data/googl.gemspec +5 -3
- data/lib/googl/base.rb +1 -1
- data/lib/googl/client_login.rb +2 -2
- data/lib/googl/expand.rb +1 -1
- data/lib/googl/request.rb +4 -2
- data/lib/googl/shorten.rb +1 -1
- data/spec/request_spec.rb +4 -0
- data/spec/shorten_spec.rb +1 -1
- metadata +35 -33
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.4. | 
| 1 | 
            +
            0.4.3
         | 
    
        data/googl.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{googl}
         | 
| 8 | 
            -
              s.version = "0.4. | 
| 8 | 
            +
              s.version = "0.4.3"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Jesus Lopes"]
         | 
| 12 | 
            -
              s.date = %q{2011- | 
| 12 | 
            +
              s.date = %q{2011-03-16}
         | 
| 13 13 | 
             
              s.description = %q{Small library for Google URL Shortener API}
         | 
| 14 14 | 
             
              s.email = %q{jlopes@zigotto.com.br}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -45,6 +45,7 @@ Gem::Specification.new do |s| | |
| 45 45 | 
             
                "spec/fixtures/shorten.json",
         | 
| 46 46 | 
             
                "spec/fixtures/shorten_authenticated.json",
         | 
| 47 47 | 
             
                "spec/fixtures/shorten_invalid_content_type.json",
         | 
| 48 | 
            +
                "spec/request_spec.rb",
         | 
| 48 49 | 
             
                "spec/shared_examples.rb",
         | 
| 49 50 | 
             
                "spec/shorten_spec.rb",
         | 
| 50 51 | 
             
                "spec/spec_helper.rb"
         | 
| @@ -52,11 +53,12 @@ Gem::Specification.new do |s| | |
| 52 53 | 
             
              s.homepage = %q{http://github.com/zigotto/googl}
         | 
| 53 54 | 
             
              s.licenses = ["MIT"]
         | 
| 54 55 | 
             
              s.require_paths = ["lib"]
         | 
| 55 | 
            -
              s.rubygems_version = %q{1. | 
| 56 | 
            +
              s.rubygems_version = %q{1.5.3}
         | 
| 56 57 | 
             
              s.summary = %q{Wrapper for Google URL Shortener API}
         | 
| 57 58 | 
             
              s.test_files = [
         | 
| 58 59 | 
             
                "spec/client_spec.rb",
         | 
| 59 60 | 
             
                "spec/expand_spec.rb",
         | 
| 61 | 
            +
                "spec/request_spec.rb",
         | 
| 60 62 | 
             
                "spec/shared_examples.rb",
         | 
| 61 63 | 
             
                "spec/shorten_spec.rb",
         | 
| 62 64 | 
             
                "spec/spec_helper.rb"
         | 
    
        data/lib/googl/base.rb
    CHANGED
    
    
    
        data/lib/googl/client_login.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ module Googl | |
| 11 11 | 
             
                #
         | 
| 12 12 | 
             
                def initialize(email, passwd)
         | 
| 13 13 | 
             
                  modify_headers('Content-Type' => 'application/x-www-form-urlencoded')
         | 
| 14 | 
            -
                  resp = Request.post(API_URL, :body => params.merge!('Email' => email, 'Passwd' => passwd))
         | 
| 14 | 
            +
                  resp = Googl::Request.post(API_URL, :body => params.merge!('Email' => email, 'Passwd' => passwd))
         | 
| 15 15 | 
             
                  @code = resp.code
         | 
| 16 16 | 
             
                  if resp.code == 200
         | 
| 17 17 | 
             
                    token = resp.split('=').last.gsub(/\n/, '')
         | 
| @@ -46,7 +46,7 @@ module Googl | |
| 46 46 | 
             
                #   history = client.history(:projection => :analytics_clicks)
         | 
| 47 47 | 
             
                #
         | 
| 48 48 | 
             
                def history(options={})
         | 
| 49 | 
            -
                  resp = options.blank? ? Request.get(API_HISTORY_URL) : Request.get(API_HISTORY_URL, :query => options)
         | 
| 49 | 
            +
                  resp = options.blank? ? Googl::Request.get(API_HISTORY_URL) : Googl::Request.get(API_HISTORY_URL, :query => options)
         | 
| 50 50 | 
             
                  if resp.code == 200
         | 
| 51 51 | 
             
                    @items = resp.parsed_response.to_openstruct
         | 
| 52 52 | 
             
                  else
         | 
    
        data/lib/googl/expand.rb
    CHANGED
    
    | @@ -12,7 +12,7 @@ module Googl | |
| 12 12 |  | 
| 13 13 | 
             
                  options.delete_if {|key, value| value.nil?}
         | 
| 14 14 |  | 
| 15 | 
            -
                  resp = Request.get(API_URL, :query => options)
         | 
| 15 | 
            +
                  resp = Googl::Request.get(API_URL, :query => options)
         | 
| 16 16 | 
             
                  if resp.code == 200
         | 
| 17 17 | 
             
                    @long_url   = resp['longUrl']
         | 
| 18 18 | 
             
                    @analytics  = resp['analytics'].to_openstruct if resp.has_key?('analytics')
         | 
    
        data/lib/googl/request.rb
    CHANGED
    
    
    
        data/lib/googl/shorten.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ module Googl | |
| 11 11 | 
             
                def initialize(long_url)
         | 
| 12 12 | 
             
                  modify_headers('Content-Type' => 'application/json')
         | 
| 13 13 | 
             
                  options = {"longUrl" => long_url}.to_json
         | 
| 14 | 
            -
                  resp = Request.post(API_URL, :body => options)
         | 
| 14 | 
            +
                  resp = Googl::Request.post(API_URL, :body => options)
         | 
| 15 15 | 
             
                  if resp.code == 200
         | 
| 16 16 | 
             
                    @short_url  = resp['id']
         | 
| 17 17 | 
             
                    @long_url   = resp['longUrl']
         | 
    
        data/spec/shorten_spec.rb
    CHANGED
    
    | @@ -17,7 +17,7 @@ describe Googl::Shorten do | |
| 17 17 | 
             
                  end
         | 
| 18 18 |  | 
| 19 19 | 
             
                  it "should return Unsupported content with type" do
         | 
| 20 | 
            -
                    Request.headers.delete('Content-Type')
         | 
| 20 | 
            +
                    Googl::Request.headers.delete('Content-Type')
         | 
| 21 21 | 
             
                    lambda { Googl.shorten('http://www.uol.com') }.should raise_error(Exception, /Unsupported content with type: application\/x-www-form-urlencoded/)
         | 
| 22 22 | 
             
                  end
         | 
| 23 23 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: googl
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 9
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 4
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.4. | 
| 9 | 
            +
              - 3
         | 
| 10 | 
            +
              version: 0.4.3
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Jesus Lopes
         | 
| @@ -15,14 +15,12 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011- | 
| 18 | 
            +
            date: 2011-03-16 00:00:00 -03:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 22 | 
            -
              prerelease: false
         | 
| 23 | 
            -
              name: httparty
         | 
| 24 22 | 
             
              type: :runtime
         | 
| 25 | 
            -
               | 
| 23 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 26 24 | 
             
                none: false
         | 
| 27 25 | 
             
                requirements: 
         | 
| 28 26 | 
             
                - - ">="
         | 
| @@ -33,12 +31,12 @@ dependencies: | |
| 33 31 | 
             
                    - 6
         | 
| 34 32 | 
             
                    - 1
         | 
| 35 33 | 
             
                    version: 0.6.1
         | 
| 36 | 
            -
               | 
| 37 | 
            -
             | 
| 34 | 
            +
              name: httparty
         | 
| 35 | 
            +
              version_requirements: *id001
         | 
| 38 36 | 
             
              prerelease: false
         | 
| 39 | 
            -
             | 
| 37 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 40 38 | 
             
              type: :runtime
         | 
| 41 | 
            -
               | 
| 39 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 42 40 | 
             
                none: false
         | 
| 43 41 | 
             
                requirements: 
         | 
| 44 42 | 
             
                - - ">="
         | 
| @@ -49,12 +47,12 @@ dependencies: | |
| 49 47 | 
             
                    - 4
         | 
| 50 48 | 
             
                    - 6
         | 
| 51 49 | 
             
                    version: 1.4.6
         | 
| 52 | 
            -
               | 
| 53 | 
            -
             | 
| 50 | 
            +
              name: json
         | 
| 51 | 
            +
              version_requirements: *id002
         | 
| 54 52 | 
             
              prerelease: false
         | 
| 55 | 
            -
             | 
| 53 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 56 54 | 
             
              type: :development
         | 
| 57 | 
            -
               | 
| 55 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 58 56 | 
             
                none: false
         | 
| 59 57 | 
             
                requirements: 
         | 
| 60 58 | 
             
                - - ~>
         | 
| @@ -65,12 +63,12 @@ dependencies: | |
| 65 63 | 
             
                    - 3
         | 
| 66 64 | 
             
                    - 0
         | 
| 67 65 | 
             
                    version: 2.3.0
         | 
| 68 | 
            -
               | 
| 69 | 
            -
             | 
| 66 | 
            +
              name: rspec
         | 
| 67 | 
            +
              version_requirements: *id003
         | 
| 70 68 | 
             
              prerelease: false
         | 
| 71 | 
            -
             | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 72 70 | 
             
              type: :development
         | 
| 73 | 
            -
               | 
| 71 | 
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 74 72 | 
             
                none: false
         | 
| 75 73 | 
             
                requirements: 
         | 
| 76 74 | 
             
                - - ~>
         | 
| @@ -81,12 +79,12 @@ dependencies: | |
| 81 79 | 
             
                    - 0
         | 
| 82 80 | 
             
                    - 0
         | 
| 83 81 | 
             
                    version: 1.0.0
         | 
| 84 | 
            -
               | 
| 85 | 
            -
             | 
| 82 | 
            +
              name: bundler
         | 
| 83 | 
            +
              version_requirements: *id004
         | 
| 86 84 | 
             
              prerelease: false
         | 
| 87 | 
            -
             | 
| 85 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 88 86 | 
             
              type: :development
         | 
| 89 | 
            -
               | 
| 87 | 
            +
              requirement: &id005 !ruby/object:Gem::Requirement 
         | 
| 90 88 | 
             
                none: false
         | 
| 91 89 | 
             
                requirements: 
         | 
| 92 90 | 
             
                - - ~>
         | 
| @@ -97,12 +95,12 @@ dependencies: | |
| 97 95 | 
             
                    - 5
         | 
| 98 96 | 
             
                    - 2
         | 
| 99 97 | 
             
                    version: 1.5.2
         | 
| 100 | 
            -
               | 
| 101 | 
            -
             | 
| 98 | 
            +
              name: jeweler
         | 
| 99 | 
            +
              version_requirements: *id005
         | 
| 102 100 | 
             
              prerelease: false
         | 
| 103 | 
            -
             | 
| 101 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 104 102 | 
             
              type: :development
         | 
| 105 | 
            -
               | 
| 103 | 
            +
              requirement: &id006 !ruby/object:Gem::Requirement 
         | 
| 106 104 | 
             
                none: false
         | 
| 107 105 | 
             
                requirements: 
         | 
| 108 106 | 
             
                - - ">="
         | 
| @@ -111,12 +109,12 @@ dependencies: | |
| 111 109 | 
             
                    segments: 
         | 
| 112 110 | 
             
                    - 0
         | 
| 113 111 | 
             
                    version: "0"
         | 
| 114 | 
            -
               | 
| 115 | 
            -
             | 
| 112 | 
            +
              name: rcov
         | 
| 113 | 
            +
              version_requirements: *id006
         | 
| 116 114 | 
             
              prerelease: false
         | 
| 117 | 
            -
             | 
| 115 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 118 116 | 
             
              type: :development
         | 
| 119 | 
            -
               | 
| 117 | 
            +
              requirement: &id007 !ruby/object:Gem::Requirement 
         | 
| 120 118 | 
             
                none: false
         | 
| 121 119 | 
             
                requirements: 
         | 
| 122 120 | 
             
                - - ~>
         | 
| @@ -127,7 +125,9 @@ dependencies: | |
| 127 125 | 
             
                    - 6
         | 
| 128 126 | 
             
                    - 2
         | 
| 129 127 | 
             
                    version: 1.6.2
         | 
| 130 | 
            -
               | 
| 128 | 
            +
              name: webmock
         | 
| 129 | 
            +
              version_requirements: *id007
         | 
| 130 | 
            +
              prerelease: false
         | 
| 131 131 | 
             
            description: Small library for Google URL Shortener API
         | 
| 132 132 | 
             
            email: jlopes@zigotto.com.br
         | 
| 133 133 | 
             
            executables: []
         | 
| @@ -166,6 +166,7 @@ files: | |
| 166 166 | 
             
            - spec/fixtures/shorten.json
         | 
| 167 167 | 
             
            - spec/fixtures/shorten_authenticated.json
         | 
| 168 168 | 
             
            - spec/fixtures/shorten_invalid_content_type.json
         | 
| 169 | 
            +
            - spec/request_spec.rb
         | 
| 169 170 | 
             
            - spec/shared_examples.rb
         | 
| 170 171 | 
             
            - spec/shorten_spec.rb
         | 
| 171 172 | 
             
            - spec/spec_helper.rb
         | 
| @@ -199,13 +200,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 199 200 | 
             
            requirements: []
         | 
| 200 201 |  | 
| 201 202 | 
             
            rubyforge_project: 
         | 
| 202 | 
            -
            rubygems_version: 1. | 
| 203 | 
            +
            rubygems_version: 1.5.3
         | 
| 203 204 | 
             
            signing_key: 
         | 
| 204 205 | 
             
            specification_version: 3
         | 
| 205 206 | 
             
            summary: Wrapper for Google URL Shortener API
         | 
| 206 207 | 
             
            test_files: 
         | 
| 207 208 | 
             
            - spec/client_spec.rb
         | 
| 208 209 | 
             
            - spec/expand_spec.rb
         | 
| 210 | 
            +
            - spec/request_spec.rb
         | 
| 209 211 | 
             
            - spec/shared_examples.rb
         | 
| 210 212 | 
             
            - spec/shorten_spec.rb
         | 
| 211 213 | 
             
            - spec/spec_helper.rb
         |