wormly 0.1.0

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.
Files changed (10) hide show
  1. data/.document +5 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +21 -0
  4. data/LICENSE.txt +20 -0
  5. data/README +7 -0
  6. data/Rakefile +33 -0
  7. data/VERSION +1 -0
  8. data/bin/wormly +20 -0
  9. data/lib/wormly.rb +23 -0
  10. metadata +103 -0
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gem "httparty"
4
+
5
+ group :development do
6
+ gem "jeweler"
7
+ end
@@ -0,0 +1,21 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ httparty (0.8.0)
6
+ multi_json
7
+ multi_xml
8
+ jeweler (1.6.4)
9
+ bundler (~> 1.0)
10
+ git (>= 1.2.5)
11
+ rake
12
+ multi_json (1.0.3)
13
+ multi_xml (0.4.0)
14
+ rake (0.9.2)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ httparty
21
+ jeweler
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Aaron Peckham
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,7 @@
1
+ Command line client and library for the Wormly API.
2
+
3
+ Examples:
4
+
5
+ - wormly get_contact_list
6
+ - wormly get_host_status
7
+ - wormly get_host_status --hostids 2
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "wormly"
18
+ gem.homepage = "http://github.com/apeckham/ruby-wormly"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Ruby client for the Wormly API}
21
+ gem.description = %Q{https://www.wormly.com/api_reference}
22
+ gem.email = "apeckham@local"
23
+ gem.authors = ["Aaron Peckham"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "bundler/setup"
5
+ require "lib/wormly"
6
+
7
+ command = ARGV.shift
8
+ raise "No command! Try get_contact_list" unless command
9
+
10
+ args = {}
11
+
12
+ until ARGV.empty?
13
+ key, value = ARGV.shift(2)
14
+ key = key.sub /^--/, ""
15
+ raise "No value given for #{key}" unless value
16
+
17
+ args[key] = value
18
+ end
19
+
20
+ puts Wormly.new.send(command, args).to_yaml
@@ -0,0 +1,23 @@
1
+ require "httparty"
2
+ require "ostruct"
3
+
4
+ raise "WORMLY_API_KEY is unset" unless ENV["WORMLY_API_KEY"]
5
+
6
+ class Wormly
7
+ include HTTParty
8
+
9
+ format :json
10
+ base_uri "https://api.wormly.com/"
11
+
12
+ def method_missing(name, args = {})
13
+ args[:key] = ENV["WORMLY_API_KEY"]
14
+ args[:response] = "json"
15
+ args[:cmd] = name.to_s.split("_").map(&:capitalize).join
16
+ args[:cmd][0..0] = args[:cmd][0..0].downcase
17
+
18
+ response = OpenStruct.new(self.class.post("/", :query => args))
19
+ raise response.errormsg unless response.errorcode.zero?
20
+
21
+ response
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wormly
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Aaron Peckham
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-09-17 00:00:00 -07:00
19
+ default_executable: wormly
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ type: :runtime
24
+ name: httparty
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ prerelease: false
37
+ type: :development
38
+ name: jeweler
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ requirement: *id002
49
+ description: https://www.wormly.com/api_reference
50
+ email: apeckham@local
51
+ executables:
52
+ - wormly
53
+ extensions: []
54
+
55
+ extra_rdoc_files:
56
+ - LICENSE.txt
57
+ - README
58
+ files:
59
+ - .document
60
+ - Gemfile
61
+ - Gemfile.lock
62
+ - LICENSE.txt
63
+ - README
64
+ - Rakefile
65
+ - VERSION
66
+ - bin/wormly
67
+ - lib/wormly.rb
68
+ has_rdoc: true
69
+ homepage: http://github.com/apeckham/ruby-wormly
70
+ licenses:
71
+ - MIT
72
+ post_install_message:
73
+ rdoc_options: []
74
+
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project:
98
+ rubygems_version: 1.3.7
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Ruby client for the Wormly API
102
+ test_files: []
103
+