Class: SocialCount::ApiBase
- Inherits:
-
Object
- Object
- SocialCount::ApiBase
- Defined in:
- lib/social_count/api_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ ApiBase
constructor
A new instance of ApiBase.
Constructor Details
#initialize(name) ⇒ ApiBase
Returns a new instance of ApiBase.
8 9 10 11 |
# File 'lib/social_count/api_base.rb', line 8 def initialize(name) raise SocialCount::Error, "#{self.class}#name cannot be blank" if name.blank? @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/social_count/api_base.rb', line 7 def name @name end |
Class Method Details
.get_http_response(uri) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/social_count/api_base.rb', line 13 def get_http_response(uri) uri = URI.escape(uri) url = URI.parse(uri) http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.request(Net::HTTP::Get.new(uri)) end |