Class: Corkboard::Publishers::Pusher

Inherits:
Object
  • Object
show all
Defined in:
lib/corkboard/publishers/pusher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ Pusher

Returns a new instance of Pusher.



8
9
10
11
# File 'lib/corkboard/publishers/pusher.rb', line 8

def initialize(credentials)
  @credentials = credentials
  configure
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



6
7
8
# File 'lib/corkboard/publishers/pusher.rb', line 6

def credentials
  @credentials
end

Instance Method Details

#publish!(entry) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/corkboard/publishers/pusher.rb', line 13

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