Project

hipchat-s3

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby library to upload files to s3 and alert users in hipchat with a link
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 2.0

Runtime

 Project Readme

Hipchat S3

A way to send file uploads to your hipchat channel using s3

Uses the hipchat gem and the aws-s3

Usage

hipchat_s3 = HipchatS3.new({:s3 => {:access_key_id => 'your-key', :secret_access_key => 'your-secret', :bucket => 'bucket'}, :hipchat => {:api_token => 'your-token'}})
hipchat_s3.s3_bucket = "another_bucket" # you can change your bucket name whenever you need

# displays thumbnail in chat that links to full size image
hipchat_s3.create_inline_image('image_path.jpg', hipchat_room_id, {:thumbnail_path => "thumb_path.jpg", :username => "Magic", :message => "message", :color => "green"})

# displays full size image, no thumbnail, directly in the chat
hipchat_s3.create_inline_image('image_path.jpg', hipchat_room_id)

# compresses a directory or file and uploads a tar.gz, linked to the room
hipchat_s3.create_compressed_upload(path_to_compress, hipchat_room_id, {:message => "Files Compressed", :color => "green"})

# uploads an uncompressed file to s3, displays link in chat
hipchat_s3.create_file_upload(file_path, hipchat_room_id, {:username => "FileManager"})

# you can also access the chat object directly
hipchat_s3.hipchat_client[hipchat_room_id].send("Enforcer", "Failure! You can't do that!!!", :notify => true, :color => "red")

Methods

create_compressed_upload(path, room, options={})
create_file_upload(file_path, room, options={})
create_inline_image(image_path, room, options={})

# Default options
{:username => 'fileuploader', :message => "File Uploaded", :color => 'yellow'}

# Default options for create_inline_image
{:thumbnail_path => nil, :username => 'fileuploader', :message => "Image Uploaded", :color => 'yellow'}

Rspec hook

config.after(:each) do
  if example.exception

    message = "#{example.full_description} <br> #{example.location}"
    hipchat_s3 ||= HipchatS3.new(HIPCHAT_S3)

    if example.metadata[:type] == :acceptance && example.metadata[:js] == true
      page.driver.browser.save_screenshot("failure.jpg")
      hipchat_s3.create_inline_image("failure.jpg", hipchat_id, {:message => message, :username => "Failmaster", :color => "red"})
    else
      hipchat_s3.hipchat_client[hipchat_id].send("Enforcer", "Failure! YOU BROKE THE BUILD <br> #{message}", :notify => true, :color => "red")
    end

  end
end