Class: Whatser::Client

Inherits:
Object
  • Object
show all
Includes:
Configuration, Http, OAuth
Defined in:
lib/whatser/client.rb

Constant Summary

Constants included from Configuration

Whatser::Configuration::DEFAULT_API_URI, Whatser::Configuration::VALID_OPTIONS_KEYS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OAuth

#get_oauth_token, #login, #oauth_authorize_url, #oauth_client

Methods included from Http

included, #request

Methods included from Configuration

included

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
24
25
26
# File 'lib/whatser/client.rb', line 18

def initialize(options={})
  Whatser::Configuration::VALID_OPTIONS_KEYS.each do |key|
    if options[key].blank?
      send("#{key}=", self.class.send(key) )
    else  
      send("#{key}=", options[key])
    end
  end
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



16
17
18
# File 'lib/whatser/client.rb', line 16

def logger
  @logger
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
# File 'lib/whatser/client.rb', line 10

def configure
  yield self
  true
end

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/whatser/client.rb', line 50

def authorized?
  !oauth_token.blank?
end

#check_insObject



28
# File 'lib/whatser/client.rb', line 28

def check_ins; Whatser::CheckIn.set(self); end

#citiesObject



38
# File 'lib/whatser/client.rb', line 38

def cities; Whatser::City.set(self); end

#collectionsObject



29
# File 'lib/whatser/client.rb', line 29

def collections; Whatser::Collection.set(self); end

#commentsObject



37
# File 'lib/whatser/client.rb', line 37

def comments; Whatser::Comment.set(self); end

#data_sourcesObject



30
# File 'lib/whatser/client.rb', line 30

def data_sources; Whatser::DataSource.set(self); end

#facebookObject



41
# File 'lib/whatser/client.rb', line 41

def facebook; Whatser::Facebook.set(self); end

#feedsObject



39
# File 'lib/whatser/client.rb', line 39

def feeds; Whatser::ActivityFeed.set(self); end

#followsObject



34
# File 'lib/whatser/client.rb', line 34

def follows; Whatser::Follow.set(self); end

#foursquareObject



42
# File 'lib/whatser/client.rb', line 42

def foursquare; Whatser::Foursquare.set(self); end

#gowallaObject



43
# File 'lib/whatser/client.rb', line 43

def gowalla; Whatser::Gowalla.set(self); end

#log(msg, level = :info) ⇒ Object



54
55
56
57
# File 'lib/whatser/client.rb', line 54

def log(msg,level=:info)
  return if logger.blank?
  logger.send(level, msg)
end

#mediaObject



31
# File 'lib/whatser/client.rb', line 31

def media; Whatser::Media.set(self); end

#spotsObject



32
# File 'lib/whatser/client.rb', line 32

def spots; Whatser::Poi.set(self); end

#subscriptionsObject



35
# File 'lib/whatser/client.rb', line 35

def subscriptions; Whatser::Subscription.set(self); end

#tagsObject



36
# File 'lib/whatser/client.rb', line 36

def tags; Whatser::Tag.set(self); end

#twitterObject



44
# File 'lib/whatser/client.rb', line 44

def twitter; Whatser::Twitter.set(self); end

#usersObject



33
# File 'lib/whatser/client.rb', line 33

def users; Whatser::User.set(self); end