Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 681817a2d7
Fetching contributors…

Cannot retrieve contributors at this time

file 35 lines (28 sloc) 0.643 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
module UrlShortener
  
  # e.g. bitly response
  # <bitly>
  # <errorCode>0</errorCode>
  # <errorMessage></errorMessage>
  # <results>
  # <31IqMl>
  # <longUrl>http://cnn.com/</longUrl>
  # </31IqMl>
  # </results>
  # <statusCode>OK</statusCode>
  # </bitly>
  
  class Response::Expand < UrlShortener::Response
    
    def initialize(response)
      super
    end
    
    def url
      long_url
    end
    
    private
    
    def base_element
      return unless attributes
      return unless attributes.first
      return unless attributes.first.is_a?(Array)
      attributes.first.last
    end
  end
  
end
Something went wrong with that request. Please try again.