nuntium_api 0.20 → 0.21
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/README.md +54 -0
- data/lib/nuntium.rb +16 -0
- metadata +71 -63
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# nuntium-api-ruby
|
2
|
+
|
3
|
+
Access the Nuntium API in Ruby.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
gem install nuntium_api
|
8
|
+
|
9
|
+
## Gemfile
|
10
|
+
|
11
|
+
gem 'nuntium_api'
|
12
|
+
|
13
|
+
## Example
|
14
|
+
|
15
|
+
require 'rubygems'
|
16
|
+
require 'nuntium'
|
17
|
+
|
18
|
+
api = Nuntium.new "service_url", "account_name", "application_name", "application_password"
|
19
|
+
|
20
|
+
message = {
|
21
|
+
:from => "sms://1234",
|
22
|
+
:to => "sms://5678",
|
23
|
+
:body => "Hello Nuntium!",
|
24
|
+
}
|
25
|
+
|
26
|
+
# Send an Application Originated message.
|
27
|
+
response = api.send_ao message
|
28
|
+
|
29
|
+
# Can also send many messages at once
|
30
|
+
messages = [{:to => "sms://1", :body => 'One'}, {:to => "sms://2", :body => 'Two'}]
|
31
|
+
response = api.send_ao messages
|
32
|
+
|
33
|
+
# Simulate sending and get a list of candidate channels
|
34
|
+
api.get_candidate_channels_for_ao message
|
35
|
+
|
36
|
+
# Get all countries
|
37
|
+
countries = api.countries
|
38
|
+
|
39
|
+
# Get all carriers that belong to a specific country
|
40
|
+
carriers = api.carriers countries[0].iso2
|
41
|
+
|
42
|
+
# Get all channels
|
43
|
+
channels = api.channels
|
44
|
+
|
45
|
+
# Create a channel
|
46
|
+
api.create_channel {
|
47
|
+
:name => "my_channel",
|
48
|
+
:kind => "clickatell",
|
49
|
+
:protocol => "sms",
|
50
|
+
:direction =>"bidirectional",
|
51
|
+
:enabled => true,
|
52
|
+
:priority => 10,
|
53
|
+
:configuration => {:password => "secret"}
|
54
|
+
}
|
data/lib/nuntium.rb
CHANGED
@@ -265,6 +265,14 @@ class Nuntium
|
|
265
265
|
end
|
266
266
|
end
|
267
267
|
|
268
|
+
# Returns a URL to authorize the given twitter channel, which will eventually redirect
|
269
|
+
# to the given callback URL.
|
270
|
+
#
|
271
|
+
# Raises Nuntium::Exception if something goes wrong.
|
272
|
+
def twitter_authorize(channel_name, callback)
|
273
|
+
get_text("/api/channels/#{channel_name}/twitter/authorize?callback=#{CGI.escape callback}")
|
274
|
+
end
|
275
|
+
|
268
276
|
# Adds an xmpp conact to the xmpp account associated to the given channel.
|
269
277
|
#
|
270
278
|
# Raises Nuntium::Exception if something goes wrong.
|
@@ -314,6 +322,14 @@ class Nuntium
|
|
314
322
|
end
|
315
323
|
end
|
316
324
|
|
325
|
+
def get_text(path)
|
326
|
+
get(path) do |response, error|
|
327
|
+
raise Nuntium::Exception.new error.message if error
|
328
|
+
|
329
|
+
response.body
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
317
333
|
def get_channels(path)
|
318
334
|
get(path) do |response, error|
|
319
335
|
raise Nuntium::Exception.new error.message if error
|
metadata
CHANGED
@@ -1,93 +1,101 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nuntium_api
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.21'
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 20
|
9
|
-
version: "0.20"
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- InsTEDD
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-11-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
20
15
|
name: rest-client
|
21
|
-
|
22
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
23
17
|
none: false
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
31
22
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: json
|
35
23
|
prerelease: false
|
36
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
25
|
none: false
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
45
38
|
type: :runtime
|
46
|
-
|
47
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Access the Nuntium API in ruby. Nuntium is an open source and free platform
|
63
|
+
-developed by InSTEDD- that allows applications to send and receive all type of
|
64
|
+
messages. Examples of messages are sms, emails and twitter direct messages.
|
48
65
|
email: aborenszweig@manas.com.ar
|
49
66
|
executables: []
|
50
|
-
|
51
67
|
extensions: []
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
files:
|
68
|
+
extra_rdoc_files:
|
69
|
+
- README.md
|
70
|
+
files:
|
56
71
|
- lib/nuntium_api.rb
|
57
72
|
- lib/nuntium.rb
|
58
73
|
- lib/nuntium/exception.rb
|
59
|
-
|
74
|
+
- README.md
|
75
|
+
homepage: https://bitbucket.org/instedd/nuntium-api-ruby/src
|
60
76
|
licenses: []
|
61
|
-
|
62
77
|
post_install_message:
|
63
|
-
rdoc_options:
|
64
|
-
|
65
|
-
require_paths:
|
78
|
+
rdoc_options:
|
79
|
+
- --charset=UTF-8
|
80
|
+
require_paths:
|
66
81
|
- lib
|
67
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
83
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
|
74
|
-
- 0
|
75
|
-
version: "0"
|
76
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
89
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
segments:
|
83
|
-
- 0
|
84
|
-
version: "0"
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
85
94
|
requirements: []
|
86
|
-
|
87
95
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.8.
|
96
|
+
rubygems_version: 1.8.23
|
89
97
|
signing_key:
|
90
98
|
specification_version: 3
|
91
99
|
summary: Access the Nuntium API in ruby
|
92
100
|
test_files: []
|
93
|
-
|
101
|
+
has_rdoc:
|