Class: GoogleBlogPingingService::Request
- Inherits:
-
Object
- Object
- GoogleBlogPingingService::Request
- Defined in:
- lib/google-blog-pinging-service.rb
Constant Summary collapse
- SERVICE_URI =
"http://blogsearch.google.com/ping"
Instance Method Summary collapse
-
#initialize(name, uri, changes_url = nil) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
- #query_string ⇒ Object
Constructor Details
#initialize(name, uri, changes_url = nil) ⇒ Request
Returns a new instance of Request.
11 12 13 14 15 16 17 |
# File 'lib/google-blog-pinging-service.rb', line 11 def initialize(name, uri, changes_url=nil) @params = { 'name' => name, 'url' => uri } @params['changesUrl'] = changes_url if changes_url end |
Instance Method Details
#perform ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/google-blog-pinging-service.rb', line 27 def perform c = Curl::Easy.new("#{SERVICE_URI}?#{query_string}") do |curl| curl.verbose = true end c.perform return c.body_str == 'Thanks for the ping.' end |
#query_string ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/google-blog-pinging-service.rb', line 19 def query_string elements = [] @params.keys.size.times do |i| elements << "#{@params.keys[i]}=#{CGI::escape(@params.values[i])}" end elements.join('&') end |