Sha256: be5173335310672682da5e519b9d34729b70a187aed3f7d8a6f7f8477936ce49

Contents?: true

Size: 719 Bytes

Versions: 4

Compression:

Stored size: 719 Bytes

Contents

require 'pusher'

module Corkboard
  module Publishers
    class Pusher
      attr_reader :credentials

      def initialize(credentials)
        @credentials = credentials
        configure
      end

      def publish!(entry)
        ::Pusher['corkboard'].trigger!('posts/new', {
          :eid     => entry.eid,
          :image   => entry.images.low_resolution.url,
          :caption => (entry.caption ? entry.caption.text : ''),
          :tags    => entry.tags
        })
      end

      private

        def configure
          ::Pusher.app_id = credentials[:client_app]
          ::Pusher.key    = credentials[:client_key]
          ::Pusher.secret = credentials[:client_secret]
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
corkboard-0.1.3 lib/corkboard/publishers/pusher.rb
corkboard-0.1.2 lib/corkboard/publishers/pusher.rb
corkboard-0.1.1 lib/corkboard/publishers/pusher.rb
corkboard-0.1.0 lib/corkboard/publishers/pusher.rb