nuntium_api 0.12 → 0.13
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/lib/nuntium.rb +6 -6
- metadata +5 -5
data/lib/nuntium.rb
CHANGED
@@ -80,7 +80,7 @@ class Nuntium
|
|
80
80
|
# update_channel :name => 'foo', :kind => 'qst_server', :protocol => 'sms', :configuration => {:password => 'bar'}
|
81
81
|
def update_channel(channel)
|
82
82
|
write_configuration channel
|
83
|
-
response = self.class.put "#{@url}/api/channels/#{channel['name']}.json", :basic_auth => @auth, :body => channel.to_json
|
83
|
+
response = self.class.put "#{@url}/api/channels/#{channel['name'] || channel[:name]}.json", :basic_auth => @auth, :body => channel.to_json
|
84
84
|
return_channel response
|
85
85
|
end
|
86
86
|
|
@@ -146,17 +146,17 @@ class Nuntium
|
|
146
146
|
|
147
147
|
def read_configuration(channel)
|
148
148
|
configuration = {}
|
149
|
-
channel['configuration'].each do |hash|
|
150
|
-
configuration[hash['name']] = hash['value']
|
149
|
+
(channel['configuration'] || channel[:configuration]).each do |hash|
|
150
|
+
configuration[hash['name'] || hash[:name]] = hash['value'] || hash[:value]
|
151
151
|
end
|
152
152
|
channel['configuration'] = configuration
|
153
153
|
end
|
154
|
-
|
154
|
+
|
155
155
|
def return_channel(response)
|
156
156
|
return nil if response.class <= String
|
157
|
-
if response.response.class <= Net::HTTPSuccess
|
157
|
+
if response.respond_to?(:response) && response.response.class <= Net::HTTPSuccess
|
158
158
|
channel = response.parsed_response.with_indifferent_access
|
159
|
-
read_configuration channel
|
159
|
+
read_configuration channel
|
160
160
|
channel
|
161
161
|
else
|
162
162
|
# TODO should wrap in exception
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nuntium_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 13
|
9
|
+
version: "0.13"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- InsTEDD
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-09-02 00:00:00 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: httparty
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
requirements: []
|
85
85
|
|
86
86
|
rubyforge_project:
|
87
|
-
rubygems_version: 1.8.
|
87
|
+
rubygems_version: 1.8.8
|
88
88
|
signing_key:
|
89
89
|
specification_version: 3
|
90
90
|
summary: Access the Nuntium API in ruby
|