class HatenablogPublisher::Api
Attributes
client[R]
header[R]
site[R]
Public Class Methods
new(site)
click to toggle source
# File lib/hatenablog_publisher/api.rb, line 8 def initialize(site) @site = site @header = { 'Accept' => 'application/xml', 'Content-Type' => 'application/xml' } consumer = OAuth::Consumer.new( ENV['HATENABLOG_CONSUMER_KEY'], ENV['HATENABLOG_CONSUMER_SECRET'], site: site, timeout: 300 ) @client = OAuth::AccessToken.new( consumer, ENV['HATENABLOG_ACCESS_TOKEN'], ENV['HATENABLOG_ACCESS_TOKEN_SECRET'] ) end
Public Instance Methods
request(path, body, method = :post)
click to toggle source
# File lib/hatenablog_publisher/api.rb, line 30 def request(path, body, method = :post) @client.request(method, path, body, @header) end