valdemaximus-conduit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.rdoc +0 -0
- data/Rakefile +18 -0
- data/VERSION +1 -0
- data/lib/valdemaximus-conduit.rb +52 -0
- data/valdemaximus-conduit.gemspec +42 -0
- metadata +60 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/
|
data/README.rdoc
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gemspec|
|
7
|
+
gemspec.name = "valdemaximus-conduit"
|
8
|
+
gemspec.summary = "Interface with MobyQ Portal"
|
9
|
+
gemspec.description = "A Library to programmatically interface with portal"
|
10
|
+
gemspec.email = "valde.maximus@gmail.com"
|
11
|
+
gemspec.homepage = "http://tomonrails.com/conduit"
|
12
|
+
gemspec.authors = ["Tom Johnson"]
|
13
|
+
end
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
17
|
+
end
|
18
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'valdemaximus-xx'
|
3
|
+
require 'net/http'
|
4
|
+
require 'net/https'
|
5
|
+
require 'uri'
|
6
|
+
require 'cgi'
|
7
|
+
|
8
|
+
module Conduit
|
9
|
+
class Conduit
|
10
|
+
def initialize(p={})
|
11
|
+
assign_properties(p)
|
12
|
+
end
|
13
|
+
|
14
|
+
def send_message(msg, list, props={})
|
15
|
+
assign_properties(props)
|
16
|
+
|
17
|
+
params = {'user_credentials' => @creds,
|
18
|
+
'body' => msg}
|
19
|
+
params.merge!(formatted_list)
|
20
|
+
|
21
|
+
@http ||= Net::HTTP.new(@domain, @port)
|
22
|
+
@http.use_ssl = false
|
23
|
+
|
24
|
+
data = ValdeMaximus::UriUtil.to_url_param({:user_credentials => @creds,
|
25
|
+
:body => msg,
|
26
|
+
'list[]' => list})
|
27
|
+
@headers = {
|
28
|
+
'Content-Type' => ValdeMaximus::UriUtil::CONTENT_TYPE
|
29
|
+
}
|
30
|
+
puts ValdeMaximus::UriUtil::CONTENT_TYPE
|
31
|
+
puts "headers = " + @headers.inspect
|
32
|
+
|
33
|
+
resp, data = @http.post2(path, data, @headers)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def assign_properties(p)
|
38
|
+
@domain = p[:domain] unless p[:domain].nil?
|
39
|
+
@port = p[:port].to_s unless p[:port].nil?
|
40
|
+
@creds = p[:creds] unless p[:creds].nil?
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
if __FILE__ == $0
|
46
|
+
c = Conduit::Conduit.new(:domain => 'localhost', :port => 3000, :creds => 'f_Le6kzsCJi5tNP7rFpQ')
|
47
|
+
res = c.send_message('hello world 10',
|
48
|
+
['8016946635, Tom Johnson',
|
49
|
+
'8016946636, Tom Johnson3',
|
50
|
+
'8016946637, Tom Johnson4'])
|
51
|
+
puts res
|
52
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{valdemaximus-conduit}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Tom Johnson"]
|
12
|
+
s.date = %q{2009-12-17}
|
13
|
+
s.description = %q{A Library to programmatically interface with portal}
|
14
|
+
s.email = %q{valde.maximus@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"lib/valdemaximus-conduit.rb",
|
24
|
+
"valdemaximus-conduit.gemspec"
|
25
|
+
]
|
26
|
+
s.homepage = %q{http://tomonrails.com/conduit}
|
27
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
s.rubygems_version = %q{1.3.5}
|
30
|
+
s.summary = %q{Interface with MobyQ Portal}
|
31
|
+
|
32
|
+
if s.respond_to? :specification_version then
|
33
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
34
|
+
s.specification_version = 3
|
35
|
+
|
36
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
37
|
+
else
|
38
|
+
end
|
39
|
+
else
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: valdemaximus-conduit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tom Johnson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-17 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A Library to programmatically interface with portal
|
17
|
+
email: valde.maximus@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- README.rdoc
|
27
|
+
- Rakefile
|
28
|
+
- VERSION
|
29
|
+
- lib/valdemaximus-conduit.rb
|
30
|
+
- valdemaximus-conduit.gemspec
|
31
|
+
has_rdoc: true
|
32
|
+
homepage: http://tomonrails.com/conduit
|
33
|
+
licenses: []
|
34
|
+
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options:
|
37
|
+
- --charset=UTF-8
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
52
|
+
requirements: []
|
53
|
+
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.3.5
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Interface with MobyQ Portal
|
59
|
+
test_files: []
|
60
|
+
|