restful_adhearsion 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README.textile +32 -0
- data/lib/restful_adhearsion.rb +27 -0
- data/restful_adhearsion.gemspec +14 -0
- metadata +77 -0
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2009 Jay Phillips & Jason Goecke
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
h1. RESTfulAdhearsion
|
2
|
+
|
3
|
+
h2. Description
|
4
|
+
|
5
|
+
Ruby library for consuming the Adhearsion RESTful RPC API.
|
6
|
+
|
7
|
+
h2. Example
|
8
|
+
|
9
|
+
<pre>
|
10
|
+
<code>
|
11
|
+
Adhearsion = RESTfulAdhearsion.new(:host => "localhost",
|
12
|
+
:port => 5000,
|
13
|
+
:user => "jicksta",
|
14
|
+
:password => "roflcopterz")
|
15
|
+
options = { :channel => "SIP/3000",
|
16
|
+
:priority => 1,
|
17
|
+
:exten => "1000",
|
18
|
+
:context => "adhearsion",
|
19
|
+
:async => "true",
|
20
|
+
:variable => "bill_this=true" }
|
21
|
+
Adhearsion.originate options
|
22
|
+
</code>
|
23
|
+
</pre>
|
24
|
+
|
25
|
+
h2. Dependencies
|
26
|
+
|
27
|
+
* json v1.1.3+
|
28
|
+
* rest-client v0.8.2+
|
29
|
+
|
30
|
+
h2. Installation
|
31
|
+
|
32
|
+
<pre>sudo gem install GMLudo-restful_adhearsion --source=http://gems.github.com/</pre>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'rest_client'
|
3
|
+
|
4
|
+
class RESTfulAdhearsion
|
5
|
+
|
6
|
+
DEFAULT_OPTIONS = {
|
7
|
+
# Note: :user and :password are non-existent by default
|
8
|
+
:host => "localhost",
|
9
|
+
:port => "5000",
|
10
|
+
:path_nesting => "/"
|
11
|
+
}
|
12
|
+
|
13
|
+
def initialize(options={})
|
14
|
+
@options = DEFAULT_OPTIONS.merge options
|
15
|
+
|
16
|
+
@path_nesting = @options.delete :path_nesting
|
17
|
+
@host = @options.delete :host
|
18
|
+
@port = @options.delete :port
|
19
|
+
|
20
|
+
@url_beginning = "http://#{@host}:#{@port}#{@path_nesting}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def method_missing(method_name, *args)
|
24
|
+
JSON.parse RestClient::Resource.new(@url_beginning + method_name.to_s, @options).post(args.to_json).body
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "restful_adhearsion"
|
3
|
+
s.version = "0.1.2"
|
4
|
+
s.summary = "Ruby Library for the Adhearsion RESTful RPC API"
|
5
|
+
s.description = "Ruby library for consuming the Adhearsion RESTful RPC API"
|
6
|
+
s.authors = ["Jason Goecke", "Jay Phillips"]
|
7
|
+
s.email = ["jason@goecke.net"]
|
8
|
+
|
9
|
+
s.files = ["lib/restful_adhearsion.rb", "LICENSE", "README.textile", "restful_adhearsion.gemspec"]
|
10
|
+
s.require_paths = ["lib"]
|
11
|
+
|
12
|
+
s.add_dependency("json", ">= 1.1.3")
|
13
|
+
s.add_dependency("rest-client", ">= 0.8.2")
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: restful_adhearsion
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Goecke
|
8
|
+
- Jay Phillips
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2010-04-15 00:00:00 +02:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: json
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 1.1.3
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rest-client
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.8.2
|
35
|
+
version:
|
36
|
+
description: Ruby library for consuming the Adhearsion RESTful RPC API
|
37
|
+
email:
|
38
|
+
- jason@goecke.net
|
39
|
+
executables: []
|
40
|
+
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
extra_rdoc_files: []
|
44
|
+
|
45
|
+
files:
|
46
|
+
- lib/restful_adhearsion.rb
|
47
|
+
- LICENSE
|
48
|
+
- README.textile
|
49
|
+
- restful_adhearsion.gemspec
|
50
|
+
has_rdoc: false
|
51
|
+
homepage:
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.3.1
|
73
|
+
signing_key:
|
74
|
+
specification_version: 2
|
75
|
+
summary: Ruby Library for the Adhearsion RESTful RPC API
|
76
|
+
test_files: []
|
77
|
+
|