Sha256: 913d192259c7f13bdf309e46ed03c96f39ce4807720e3b518edc939f6caf2438

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

module Travis
  module Notifications
    class Pusher
      class Payload
        attr_reader :event, :object, :extra

        def initialize(event, object, extra = {})
          @event, @object, @extra = event, object, extra
        end

        def to_hash
          render(:hash)
        end

        def render(format)
          Travis::Renderer.send(format, data, :type => :event, :template => template, :base_dir => base_dir).deep_merge(extra)
        end

        def data
          { :build => object, :repository => object.repository }
        end

        def template
          event.to_s.split(':').join('/')
        end

        def base_dir
          File.expand_path('../views', __FILE__)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 lib/travis/notifications/pusher/payload.rb