Sha256: 8720e2fa7a1f2865209ab4a2d0d60666c1568bd80c40da3996055b8f57f5420a
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
require 'rest-core' RestCore::Linkedin = RestCore::Builder.client(:data) do s = self.class # this is only for ruby 1.8! use s::Timeout , 10 use s::DefaultSite , 'https://api.linkedin.com/' use s::DefaultHeaders, {'Accept' => 'application/json'} use s::DefaultQuery , {'format' => 'json'} use s::Oauth1Header , 'uas/oauth/requestToken', 'uas/oauth/accessToken', 'https://www.linkedin.com/uas/oauth/authorize' use s::CommonLogger , nil use s::Cache , nil, 3600 do use s::ErrorHandler, lambda{|env| if (body = env[s::RESPONSE_BODY]).kind_of?(Hash) raise body['message'] else raise body end } use s::ErrorDetectorHttp use s::JsonDecode , true end use s::Defaults , :data => lambda{{}} end module RestCore::Linkedin::Client include RestCore def oauth_token data['oauth_token'] if data.kind_of?(Hash) end def oauth_token= token data['oauth_token'] = token if data.kind_of?(Hash) end def oauth_token_secret data['oauth_token_secret'] if data.kind_of?(Hash) end def oauth_token_secret= secret data['oauth_token_secret'] = secret if data.kind_of?(Hash) end def me queries={}, opts={} get('v1/people/~', queries, opts) end private def set_token query self.data = query end end RestCore::Linkedin.send(:include, RestCore::ClientOauth1) RestCore::Linkedin.send(:include, RestCore::Linkedin::Client)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rest-core-0.4.0.pre.1 | lib/rest-core/client/linkedin.rb |
rest-core-0.4.0.pre.0 | lib/rest-core/client/linkedin.rb |