Class: Travis::Notifications::Webhook::Payload

Inherits:
Object
  • Object
show all
Defined in:
lib/travis/notifications/webhook/payload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Payload

Returns a new instance of Payload.



7
8
9
# File 'lib/travis/notifications/webhook/payload.rb', line 7

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



5
6
7
# File 'lib/travis/notifications/webhook/payload.rb', line 5

def object
  @object
end

Instance Method Details

#base_dirObject



23
24
25
# File 'lib/travis/notifications/webhook/payload.rb', line 23

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

#render(format) ⇒ Object



15
16
17
# File 'lib/travis/notifications/webhook/payload.rb', line 15

def render(format)
  Travis::Renderer.send(format, object, :type => :webhook, :template => template, :base_dir => base_dir)
end

#templateObject



19
20
21
# File 'lib/travis/notifications/webhook/payload.rb', line 19

def template
  object.class.name.underscore
end

#to_hashObject



11
12
13
# File 'lib/travis/notifications/webhook/payload.rb', line 11

def to_hash
  render(:hash)
end