Skip to content

Commit

Permalink
Make Twitter::Place#id attribute accessible
Browse files Browse the repository at this point in the history
Closes #544.
  • Loading branch information
sferik committed Mar 19, 2014
1 parent f1b42bf commit a4fa473
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions lib/twitter/place.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
require 'equalizer'
require 'twitter/base'
require 'twitter/identity'

module Twitter
class Place < Twitter::Base
attr_reader :attributes, :country, :full_name, :name, :woeid
alias_method :woe_id, :woeid
class Place < Twitter::Identity
attr_reader :attributes, :country, :full_name, :name
alias_method :woe_id, :id
alias_method :woeid, :id
object_attr_reader :GeoFactory, :bounding_box
object_attr_reader :Place, :contained_within
alias_method :contained?, :contained_within?
uri_attr_reader :uri

# @param other [Twitter::Place]
# @return [Boolean]
def eql?(other)
super || instance_of?(other.class) && !woeid.nil? && other.respond_to?(:woeid) && woeid.eql?(other.woeid)
end

# @param other [Twitter::Place]
# @return [Boolean]
def ==(other)
other = coerce(other) if respond_to?(:coerce, true)
super || kind_of?(self.class) && !woeid.nil? && other.respond_to?(:woeid) && woeid == other.woeid
# Initializes a new place
#
# @param attrs [Hash]
# @raise [ArgumentError] Error raised when supplied argument is missing an :id key.
# @return [Twitter::Identity]
def initialize(attrs = {})
attrs[:id] ||= attrs[:woeid]
super
end

# @return [String]
Expand Down

0 comments on commit a4fa473

Please sign in to comment.