Class: SocialOauthApi::Base
- Inherits:
-
Object
- Object
- SocialOauthApi::Base
- Defined in:
- lib/social_oauth_api/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
Instance Method Summary collapse
- #get(url, query) ⇒ Object
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 |
# File 'lib/social_oauth_api/base.rb', line 7 def initialize @client_id = [:client_id] @client_secret = [:client_secret] @access_token = [:access_token] end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/social_oauth_api/base.rb', line 5 def access_token @access_token end |
#client_id ⇒ Object
Returns the value of attribute client_id.
5 6 7 |
# File 'lib/social_oauth_api/base.rb', line 5 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
5 6 7 |
# File 'lib/social_oauth_api/base.rb', line 5 def client_secret @client_secret end |
Instance Method Details
#get(url, query) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/social_oauth_api/base.rb', line 13 def get url, query uri = URI(url) uri.query = URI.encode_www_form(query) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == 'https' request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) response.body end |