Sha256: 1fd290da503d8d3b69d7b3532d6dfb9e35d26e9b2cadef1a0aaf3461130b225d

Contents?: true

Size: 824 Bytes

Versions: 1

Compression:

Stored size: 824 Bytes

Contents

module Gnip
  class Url < Gnip::Message
    attr_reader :url, :expanded_url, :expanded_status, :display_url, :indices

    def initialize params={}
      @url = params['url']
      @expanded_url = params['expanded_url']
      @display_url = params['display_url']
      @expanded_status = params['expanded_status']
      @indices = params['indices']
    end

    def url
      URI(@url) unless @url.nil?
    end
    
    def expanded_url
      URI(@expanded_url) unless @expanded_url.nil?
    end

    def original_attributes
      {
        :url => @url,
        :display_url => @display_url,
        :expanded_url => @expanded_url,
        :expanded_status => @expanded_status,
        :indices => @indices
      }.delete_if{|k,v| v.nil?}
    end

    def to_json
      generate_json(original_attributes)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gnip_api-0.0.3 lib/gnip_api/gnip/url.rb