Giter Site home page Giter Site logo

google_url_shortener's Introduction

Hey! ๐Ÿ‘‹

Clients

I'm Josh, a software engineer and technical leader. My work spans from hands-on projects building large platforms to leading some of the best-performing teams in our industry.

I also run internationally recognised conferences and events, which bring people from all over the world to the heart of Leeds to learn, inspire and share stories.

google_url_shortener's People

Contributors

joselo avatar joshnesbitt avatar lukeasrodgers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

google_url_shortener's Issues

It breaks with custom URIs

I'm honestly not sure what's supposed to do with non-HTTP custom URIs but I thought you might want to know that it raises an error if given a custom URI:

[13] pry(main)> url
=> "ovsapp://foobar"
[14] pry(main)> Google::UrlShortener.shorten!(url)
RestClient.post "https://www.googleapis.com/urlshortener/v1/url?key=MY_KEY", "{\"longUrl\":\"ovsapp://foobar\"}", "Accept"=>"application/json", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"29", "Content-Type"=>"application/json", "User-Agent"=>"rest-client/2.0.0 (darwin16.1.0 x86_64) ruby/2.3.3p222"
# => 400 BadRequest | application/json 160 bytes
#<RestClient::BadRequest: 400 Bad Request>
NoMethodError: undefined method `[]' for nil:NilClass
from /Users/rhymes/.rvm/gems/ruby-2.3.3/gems/google_url_shortener-1.1.0/lib/google/url_shortener/url.rb:27:in `encode!'

it seems like https://github.com/joshnesbitt/google_url_shortener/blob/master/lib/google/url_shortener/url.rb#L25 returns nil as response, and then at line https://github.com/joshnesbitt/google_url_shortener/blob/master/lib/google/url_shortener/url.rb#L27 it breaks.

Cannot get analytics to work

Everything works beautifully except when I try to get analytics:

$ googl s http://apple.blogoverflow.com/2012/07/interesting-new-unix-commandsbinaries-in-os-x-mountain-lion/
http://goo.gl/0MKuB
$ googl e http://goo.gl/0MKuB
http://apple.blogoverflow.com/2012/07/interesting-new-unix-commandsbinaries-in-os-x-mountain-lion/
$ googl expand http://goo.gl/0MKuB -a
/Library/Ruby/Gems/1.8/gems/google_url_shortener-0.0.6/lib/google/url_shortener/cli.rb:57:in decode_analytics': undefined methodupcase' for :all:Symbol (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/google_url_shortener-0.0.6/lib/google/url_shortener/cli.rb:56:in each' from /Library/Ruby/Gems/1.8/gems/google_url_shortener-0.0.6/lib/google/url_shortener/cli.rb:56:indecode_analytics'
from /Library/Ruby/Gems/1.8/gems/google_url_shortener-0.0.6/lib/google/url_shortener/cli.rb:35:in run!' from /Library/Ruby/Gems/1.8/gems/google_url_shortener-0.0.6/bin/googl:6 from /usr/bin/googl:19:inload'
from /usr/bin/googl:19

I'm running Mountain Lion 10.8.

I'm got 403 as response for postMethod

The following post request every returns 403 message.

TMedico = class
public
  id_corporativo : string;
  nome : string;
  cpf : string;
  crm : string;

  constructor Create(id_corporativo, nome, cpf, crm : string);
end;

procedre myForm.myMethod(medico :TMedico);
begin
  restClient := TRestClient.Create(nil);
  restClient.ConnectionType := THttpConnectionType.hctIndy;
  restClient.Resource('http://starttec.com.br/apimed/api/medico/')
            .Accept(RestUtils.MediaType_Json)
            .ContentType(RestUtils.MediaType_Json)
            .Post<TMedico>(medico);
end;

image

RestClient::Forbidden: 403 Forbidden

Recently started getting this error.
url = Google::UrlShortener::Url.new(:long_url => long_url) => #<Google::UrlShortener::Url:0x007f8e660e6c48 @long_url= "http://www.example.com/"> [4] pry(main)> url.shorten! RestClient::Forbidden: 403 Forbidden from /Users/xxxxxx/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in return!'`

#<RestClient::BadRequest: 400 Bad Request>

โžœ abc git:(master): ruby -v
ruby 2.2.6p322 (2016-04-29 revision 54815) [x86_64-darwin15]

โžœ abc git:(master): rails -v
Rails 5.0.2

โžœ abc git:(master): gem -v
2.6.4

โžœ abc git:(master): bundler -v
Bundler version 1.14.6

โžœ abc git:(master): gem list google_url_shortener
*** LOCAL GEMS ***
google_url_shortener (1.1.0)

โžœ abc git:(master): rails c
:009 > t = 'https://mdbootstrap.com/components/inputs'
=> "https://mdbootstrap.com/components/inputs"

:010 > st = Google::UrlShortener.shorten! t
RestClient.post "https://www.googleapis.com/urlshortener/v1/url?key=xxxxxxxxxxxxxxxxxxxxx", "{"longUrl":"https://mdbootstrap.com/components/inputs\"}", "Accept"=>"application/json", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"55", "Content-Type"=>"application/json", "User-Agent"=>"rest-client/2.0.2 (darwin15.5.0 x86_64) ruby/2.2.6p322"

=> 400 BadRequest | application/json 132 bytes

#<RestClient::BadRequest: 400 Bad Request>
NoMethodError: undefined method []' for nil:NilClass from /Users/jdm/.rvm/gems/ruby-2.2-head@abc/gems/google_url_shortener-1.1.0/lib/google/url_shortener/url.rb:27:in encode!'
from /Users/jdm/.rvm/gems/ruby-2.2-head@abc/gems/google_url_shortener-1.1.0/lib/google/url_shortener.rb:13:in shorten!' from (irb):10 from /Users/jdm/.rvm/gems/ruby-2.2-head@abc/gems/railties-5.0.2/lib/rails/commands/console.rb:65:in start'
from /Users/jdm/.rvm/gems/ruby-2.2-head@abc/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in start' from /Users/jdm/.rvm/gems/ruby-2.2-head@abc/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in console'
from /Users/jdm/.rvm/gems/ruby-2.2-head@abc/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in run_command!' from /Users/jdm/.rvm/gems/ruby-2.2-head@abc/gems/railties-5.0.2/lib/rails/commands.rb:18:in <top (required)>'
from bin/rails:4:in require' from bin/rails:4:in

'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.