alert_grid 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
 - data/Gemfile +4 -0
 - data/README +9 -0
 - data/Rakefile +1 -0
 - data/alert_grid.gemspec +20 -0
 - data/lib/alert_grid.rb +44 -0
 - data/lib/alert_grid/version.rb +3 -0
 - metadata +54 -0
 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/README
    ADDED
    
    
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'bundler/gem_tasks'
         
     | 
    
        data/alert_grid.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- encoding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
            $:.push File.expand_path("../lib", __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "alert_grid/version"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.name        = "alert_grid"
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.version     = AlertGrid::VERSION
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.authors     = ["Arun Kumar Arjunan"]
         
     | 
| 
      
 9 
     | 
    
         
            +
              s.email       = ["arun.immanuel1608@gmail"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              s.homepage    = ""
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.summary     = %q{Ruby gem to send signals to alertgrid}
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.description = %q{Ruby gem to send signals to alertgrid}
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              s.rubyforge_project = "alert_grid"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              s.files         = `git ls-files`.split("\n")
         
     | 
| 
      
 17 
     | 
    
         
            +
              s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         
     | 
| 
      
 18 
     | 
    
         
            +
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              s.require_paths = ["lib"]
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/alert_grid.rb
    ADDED
    
    | 
         @@ -0,0 +1,44 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "alert_grid/version"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'net/http'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module AlertGrid
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Signal
         
     | 
| 
      
 8 
     | 
    
         
            +
                API_PATH = 'http://hq.alert-grid.com/save-signal/'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def api_id
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @@api_id
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def api_id=(value)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @@api_id = value
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                attr_accessor :receiver
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def initialize(receiver)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  self.receiver = receiver
         
     | 
| 
      
 24 
     | 
    
         
            +
                  raise Exception.new("Specify API ID using AlertGrid::Signal.api_id = '<api_id>'" ) if @@api_id.nil?
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def trigger(options = {})
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Net::HTTP.post_form(URI.parse(API_PATH),
         
     | 
| 
      
 29 
     | 
    
         
            +
                    {
         
     | 
| 
      
 30 
     | 
    
         
            +
                      'api_id'         => URI.escape(@@api_id),
         
     | 
| 
      
 31 
     | 
    
         
            +
                      'receiver_name'  => URI.escape(self.receiver)
         
     | 
| 
      
 32 
     | 
    
         
            +
                    }.merge(escape(options))
         
     | 
| 
      
 33 
     | 
    
         
            +
                  )
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                def escape(options)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  options.each do |key, value|
         
     | 
| 
      
 38 
     | 
    
         
            +
                    options[key] = URI.escape(value)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  return options
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: alert_grid
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
      
 6 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Arun Kumar Arjunan
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 11 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2011-06-30 00:00:00.000000000 +05:30
         
     | 
| 
      
 13 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 14 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 15 
     | 
    
         
            +
            description: Ruby gem to send signals to alertgrid
         
     | 
| 
      
 16 
     | 
    
         
            +
            email:
         
     | 
| 
      
 17 
     | 
    
         
            +
            - arun.immanuel1608@gmail
         
     | 
| 
      
 18 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 19 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 20 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 21 
     | 
    
         
            +
            files:
         
     | 
| 
      
 22 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 23 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 24 
     | 
    
         
            +
            - README
         
     | 
| 
      
 25 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 26 
     | 
    
         
            +
            - alert_grid.gemspec
         
     | 
| 
      
 27 
     | 
    
         
            +
            - lib/alert_grid.rb
         
     | 
| 
      
 28 
     | 
    
         
            +
            - lib/alert_grid/version.rb
         
     | 
| 
      
 29 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 30 
     | 
    
         
            +
            homepage: ''
         
     | 
| 
      
 31 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 32 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 33 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 34 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 35 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 36 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 38 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 39 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 40 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 41 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 42 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 43 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 44 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 46 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 49 
     | 
    
         
            +
            rubyforge_project: alert_grid
         
     | 
| 
      
 50 
     | 
    
         
            +
            rubygems_version: 1.6.2
         
     | 
| 
      
 51 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 52 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 53 
     | 
    
         
            +
            summary: Ruby gem to send signals to alertgrid
         
     | 
| 
      
 54 
     | 
    
         
            +
            test_files: []
         
     |