Rebuild assets

This commit is contained in:
2023-02-01 21:13:19 +11:00
parent 8cbcd08411
commit 1defc79496
6 changed files with 56 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
require "pinboard"
require "dry/monads"
module Adamantium
module Syndication
class Pinboard
attr_reader :pinboard
include Dry::Monads[:result]
def initialize(api_key:)
@pinboard = Pinboard::Client.new(token: api_key)
end
def call(post:)
if pinboard.add(url: post[:url], description: post[:content]) == "done"
href = pinboard.get(url: post[:url]).href
Success(href)
else
Failure(:failed_to_post_to_pinboard)
end
end
end
end
end