boundio 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +1 -1
- data/lib/boundio/audio_file.rb +4 -0
- data/lib/boundio/call.rb +3 -3
- data/lib/boundio/resource.rb +9 -10
- data/lib/boundio/version.rb +1 -1
- data/test/test_audio_file.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +5 -4
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Mobalean LLC
|
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.md
CHANGED
@@ -2,4 +2,4 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/[YOUR_GITHUB_USERNAME]/[YOUR_PROJECT_NAME].png)](http://travis-ci.org/pwim/boundio)
|
4
4
|
|
5
|
-
Alpha-version of the beta-api for Boundio. See
|
5
|
+
Alpha-version of the beta-api for Boundio. See [the documentation](http://www.doorkeeperhq.com/developer/boundio-ruby-gem) for details.
|
data/lib/boundio/audio_file.rb
CHANGED
data/lib/boundio/call.rb
CHANGED
@@ -2,7 +2,7 @@ module Boundio
|
|
2
2
|
class Call < Resource
|
3
3
|
attr_accessor :tel_to, :cast, :id
|
4
4
|
def self.exceptions
|
5
|
-
super.merge(4 => NotEnoughPoints)
|
5
|
+
super.merge(3 => NoVoiceFile, 4 => NotEnoughPoints)
|
6
6
|
end
|
7
7
|
|
8
8
|
def save
|
@@ -11,7 +11,7 @@ module Boundio
|
|
11
11
|
true
|
12
12
|
end
|
13
13
|
|
14
|
-
class NotEnoughPoints < Boundio::Exception
|
15
|
-
end
|
14
|
+
class NotEnoughPoints < Boundio::Exception; end
|
15
|
+
class NoVoiceFile < Boundio::Exception; end
|
16
16
|
end
|
17
17
|
end
|
data/lib/boundio/resource.rb
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
module Boundio
|
2
2
|
class Resource
|
3
3
|
class << self
|
4
|
-
def
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
def api_key
|
9
|
-
ENV["BOUNDIO_API_KEY"]
|
4
|
+
def api_version
|
5
|
+
"vd1"
|
10
6
|
end
|
11
7
|
|
12
|
-
|
13
|
-
|
8
|
+
%w[user_serial_id api_key user_key].each do |s|
|
9
|
+
var = "BOUNDIO_#{s.upcase}"
|
10
|
+
define_method(s) do
|
11
|
+
ENV[var] || raise("Please export #{var}")
|
12
|
+
end
|
14
13
|
end
|
15
14
|
|
16
15
|
def request(method, path, params)
|
17
|
-
params = params.merge(:key => api_key, :auth =>
|
16
|
+
params = params.merge(:key => api_key, :auth => user_key)
|
18
17
|
res = RestClient.send method,
|
19
|
-
File.join("https://boundio.jp/api/
|
18
|
+
File.join("https://boundio.jp/api/", api_version, user_serial_id, path),
|
20
19
|
method == :get ? { :params => params } : params
|
21
20
|
res = JSON.parse(res)
|
22
21
|
res = res.first if res.is_a?(Array)
|
data/lib/boundio/version.rb
CHANGED
data/test/test_audio_file.rb
CHANGED
@@ -2,7 +2,7 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class TestAudioFile < BoundioTest
|
4
4
|
def test_create
|
5
|
-
stub_request(:post, "https://boundio.jp/api/
|
5
|
+
stub_request(:post, "https://boundio.jp/api/v1/user_serial_id/file/post").
|
6
6
|
with(:body => {"auth"=>"user_authentication_key", "convtext"=>"foo", "filename"=>"foo", "key"=>"api_key"}).to_return(:body => {:success => "true", :fileid => 5}.to_json)
|
7
7
|
file = Boundio::AudioFile.new(:convtext => "foo")
|
8
8
|
file.save
|
data/test/test_helper.rb
CHANGED
@@ -7,7 +7,7 @@ class BoundioTest < MiniTest::Unit::TestCase
|
|
7
7
|
def setup
|
8
8
|
ENV["BOUNDIO_USER_SERIAL_ID"] = "user_serial_id"
|
9
9
|
ENV["BOUNDIO_API_KEY"] = "api_key"
|
10
|
-
ENV["
|
10
|
+
ENV["BOUNDIO_USER_KEY"] = "user_authentication_key"
|
11
11
|
end
|
12
12
|
|
13
13
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boundio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paul McMahon
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: minitest
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- .gitignore
|
129
129
|
- .travis.yml
|
130
130
|
- Gemfile
|
131
|
+
- LICENSE
|
131
132
|
- README.md
|
132
133
|
- Rakefile
|
133
134
|
- bin/boundio
|