class Postwill::Providers::Pinterest
Public Class Methods
new(options)
click to toggle source
# File lib/postwill/providers/pinterest.rb, line 4 def initialize(options) @client ||= ::Pinterest::Client.new(options[:access_token]) end
Private Instance Methods
post(options)
click to toggle source
# File lib/postwill/providers/pinterest.rb, line 10 def post(options) params = { board: options[:board_id], note: options[:text], link: options[:link], image_url: options[:image_url], image: options[:image] }.compact response(client.create_pin(params).to_h) end
response(result)
click to toggle source
# File lib/postwill/providers/pinterest.rb, line 22 def response(result) raise Exception, result['message'] unless result.dig('data', 'id') result end