class Micropub::Client
Attributes
post_type[R]
token[R]
Public Class Methods
new(post_type, attrs={})
click to toggle source
# File lib/micropub/client.rb, line 8 def initialize(post_type, attrs={}) @post_type = post_type @token = attrs[:token] end
Public Instance Methods
headers()
click to toggle source
# File lib/micropub/client.rb, line 21 def headers {"Authorization" => "Bearer #{token}"} end
host()
click to toggle source
# File lib/micropub/client.rb, line 33 def host # ENV is temp to hardcode the host before # the hs router is hooked up. ENV["PUBLISHER_HOST"] || Micropub.configuration.me end
post(content)
click to toggle source
# File lib/micropub/client.rb, line 13 def post(content) request HTTPClient.post(uri, content, headers) end
publisher()
click to toggle source
# File lib/micropub/client.rb, line 25 def publisher post_type.pluralize end
request(response)
click to toggle source
# File lib/micropub/client.rb, line 17 def request(response) Micropub::Response.new(response) end
uri()
click to toggle source
# File lib/micropub/client.rb, line 29 def uri "#{host}/#{publisher}" end