Skip to content

Commit

Permalink
Method spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Oct 18, 2011
1 parent d63d2e5 commit 1dd37f2
Show file tree
Hide file tree
Showing 26 changed files with 50 additions and 23 deletions.
1 change: 1 addition & 0 deletions lib/twitter/api.rb
Expand Up @@ -18,5 +18,6 @@ def initialize(options={})
send("#{key}=", options[key])
end
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/authenticatable.rb
Expand Up @@ -19,5 +19,6 @@ def credentials
def authenticated?
credentials.values.all?
end

end
end
2 changes: 2 additions & 0 deletions lib/twitter/base.rb
@@ -1,5 +1,6 @@
module Twitter
class Base

def initialize(hash={})
hash.each do |key, value|
instance_variable_set(:"@#{key}", value) unless value.nil?
Expand All @@ -13,5 +14,6 @@ def [](method)
def to_hash
Hash[instance_variables.map{|ivar| [ivar[1..-1].to_sym, instance_variable_get(ivar)]}]
end

end
end
2 changes: 2 additions & 0 deletions lib/twitter/client.rb
Expand Up @@ -26,6 +26,7 @@ module Twitter
# @note All methods have been separated into modules and follow the same grouping used in {http://dev.twitter.com/doc the Twitter API Documentation}.
# @see http://dev.twitter.com/pages/every_developer
class Client < API

# Require client method modules after initializing the Client class in
# order to avoid a superclass mismatch error, allowing those modules to be
# Client-namespaced.
Expand Down Expand Up @@ -74,5 +75,6 @@ class Client < API
include Twitter::Client::Tweets
include Twitter::Client::Urls
include Twitter::Client::Users

end
end
1 change: 1 addition & 0 deletions lib/twitter/config.rb
Expand Up @@ -97,5 +97,6 @@ def reset
self.faraday_options = DEFAULT_FARADAY_OPTIONS
self
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/configuration.rb
Expand Up @@ -19,5 +19,6 @@ def initialize(configuration={})
@short_url_length = configuration['short_url_length']
@short_url_length_https = configuration['short_url_length_https']
end

end
end
2 changes: 1 addition & 1 deletion lib/twitter/connection.rb
Expand Up @@ -20,7 +20,6 @@ def connection(options={})
:ssl => {:verify => false},
:url => options.fetch(:endpoint, api_endpoint),
})

Faraday.new(merged_options) do |builder|
builder.use Twitter::Request::Phoenix if options[:phoenix]
builder.use Twitter::Request::MultipartWithFile
Expand All @@ -34,5 +33,6 @@ def connection(options={})
builder.adapter(adapter)
end
end

end
end
2 changes: 2 additions & 0 deletions lib/twitter/creatable.rb
Expand Up @@ -2,11 +2,13 @@

module Twitter
module Creatable

# Time when the user was created
#
# @return [Time]
def created_at
@created_at = Time.parse(@created_at) unless @created_at.nil? || @created_at.is_a?(Time)
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/cursor.rb
Expand Up @@ -31,5 +31,6 @@ def last?
@next_cursor.zero?
end
alias :last :last?

end
end
1 change: 1 addition & 0 deletions lib/twitter/direct_message.rb
Expand Up @@ -18,5 +18,6 @@ def initialize(direct_message={})
def ==(other)
super || (other.class == self.class && other.id == @id)
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/error.rb
Expand Up @@ -23,5 +23,6 @@ def ratelimit_remaining
def retry_after
[(ratelimit_reset - Time.now).ceil, 0].max
end

end
end
2 changes: 2 additions & 0 deletions lib/twitter/geo_factory.rb
Expand Up @@ -3,6 +3,7 @@

module Twitter
class GeoFactory

def self.new(geo)
type = geo['type']
if type
Expand All @@ -11,5 +12,6 @@ def self.new(geo)
raise ArgumentError, "argument must have a type key"
end
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/list.rb
Expand Up @@ -24,5 +24,6 @@ def initialize(list={})
def ==(other)
super || (other.class == self.class && other.id == @id)
end

end
end
2 changes: 2 additions & 0 deletions lib/twitter/media_factory.rb
Expand Up @@ -2,6 +2,7 @@

module Twitter
class MediaFactory

def self.new(media)
type = media['type']
if type
Expand All @@ -10,5 +11,6 @@ def self.new(media)
raise ArgumentError, "argument must have a type key"
end
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/place.rb
Expand Up @@ -23,5 +23,6 @@ def initialize(place={})
def ==(other)
super || (other.class == self.class && other.id == @id)
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/polygon.rb
Expand Up @@ -7,5 +7,6 @@ class Polygon < Twitter::Base
def ==(other)
super || (other.class == self.class && other.coordinates == self.coordinates)
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/rate_limit_status.rb
Expand Up @@ -10,5 +10,6 @@ class RateLimitStatus < Twitter::Base
def reset_time
@reset_time = Time.parse(@reset_time) unless @reset_time.nil? || @reset_time.is_a?(Time)
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/relationship.rb
Expand Up @@ -9,5 +9,6 @@ def initialize(relationship={})
@source = Twitter::User.new(relationship['source']) unless relationship['source'].nil?
@target = Twitter::User.new(relationship['target']) unless relationship['target'].nil?
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/saved_search.rb
Expand Up @@ -9,5 +9,6 @@ class SavedSearch < Twitter::Base
def ==(other)
super || (other.class == self.class && other.id == @id)
end

end
end
4 changes: 2 additions & 2 deletions lib/twitter/size.rb
Expand Up @@ -3,12 +3,12 @@
module Twitter
class Size < Twitter::Base
attr_reader :h, :resize, :w
alias :height :h
alias :width :w

def ==(other)
super || (other.class == self.class && other.height == self.height && other.width == self.width)
end

alias :height :h
alias :width :w
end
end
1 change: 1 addition & 0 deletions lib/twitter/status.rb
Expand Up @@ -53,5 +53,6 @@ def initialize(status={})
def ==(other)
super || (other.class == self.class && other.id == @id)
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/suggestion.rb
Expand Up @@ -17,5 +17,6 @@ def initialize(suggestion={})
def ==(other)
super || (other.class == self.class && other.slug == @slug)
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/trend.rb
Expand Up @@ -7,5 +7,6 @@ class Trend < Twitter::Base
def ==(other)
super || (other.class == self.class && other.name == self.name)
end

end
end
1 change: 1 addition & 0 deletions lib/twitter/user.rb
Expand Up @@ -100,5 +100,6 @@ def initialize(user={})
def ==(other)
super || (other.class == self.class && other.id == @id)
end

end
end
32 changes: 16 additions & 16 deletions lib/twitter/version.rb
@@ -1,25 +1,25 @@
module Twitter
class Version
class << self
def major
2
end

def minor
0
end
def self.major
2
end

def self.minor
0
end

def patch
0
end
def self.patch
0
end

def pre
nil
end
def self.pre
nil
end

def to_s
[major, minor, patch, pre].compact.join('.')
end
def self.to_s
[major, minor, patch, pre].compact.join('.')
end

end
end
8 changes: 4 additions & 4 deletions spec/twitter/rate_limit_status_spec.rb
Expand Up @@ -4,12 +4,12 @@

describe "#reset_time" do
it "should return a Time when reset_time is set" do
user = Twitter::RateLimitStatus.new('reset_time' => "Mon Jul 16 12:59:01 +0000 2007")
user.reset_time.should be_a Time
rate_limit_status = Twitter::RateLimitStatus.new('reset_time' => "Mon Jul 16 12:59:01 +0000 2007")
rate_limit_status.reset_time.should be_a Time
end
it "should return nil when reset_time is not set" do
user = Twitter::RateLimitStatus.new
user.reset_time.should be_nil
rate_limit_status = Twitter::RateLimitStatus.new
rate_limit_status.reset_time.should be_nil
end
end

Expand Down

0 comments on commit 1dd37f2

Please sign in to comment.