voicebase-client-ruby 1.1.1 → 1.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e34c7f64b2cff85bd6041603b9595a27aba1b116
4
- data.tar.gz: f8ad40f9b1836e48aff188d820cae2cbea202e24
3
+ metadata.gz: 5445e1026c14d88f3055f3d8782973aa2f52395b
4
+ data.tar.gz: 21994418f75521b8b912463ef9284cff52dc42b0
5
5
  SHA512:
6
- metadata.gz: 2cb121e907b5260d0f413c21ae59f3119ed557e69fc994ada0fe3228192ff2accf6b9b40b32c9cf2e242df835e69f2ce242bd0fcbde59f0b2e627c8e36df97a2
7
- data.tar.gz: b4d8f2039965c45d00c082f09981ddef7f7af17c66d75aa9af581777e98bf1aca11449630435056d9c1339599fc2d7dc6cdfdf43be8dfc47a362e3419357d8c6
6
+ metadata.gz: 4a9da1f05df02a5c65d9959a7b879a0ce1e21e6b5ccbdc92d8448493aee54b6249cebfeece74c75101f26485fd22e7cb270c7b5384b9a3f721bbe3820cd85565
7
+ data.tar.gz: 1bf4bdce7a8580e8ab263a015cdae71d49dcf3529e833ba901da90357de5a1e144b241577cf9186d4a692082db42b8243227d07983aa2cc5c2766150f066452f
data/README.md CHANGED
@@ -83,7 +83,9 @@ client.get_transcript({
83
83
 
84
84
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
85
85
 
86
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
86
+ To install this gem onto your local machine, run `bundle exec rake install`.
87
+
88
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
87
89
 
88
90
  ## Contributing
89
91
 
@@ -27,35 +27,14 @@ module VoiceBase
27
27
 
28
28
  def upload_media(args = {}, headers = {})
29
29
  media_url = require_media_file_or_url(args)
30
-
31
- form_args = {
32
- 'media' => media_url,
33
- 'configuration' => {
34
- 'configuration' => {
35
- 'executor' => 'v2'
36
- }
37
- }
38
- }
39
-
40
- # external ID is only partially supported in the V2 API (can't get plain text transcripts or delete media)
41
- if args[:external_id]
42
- form_args.merge!({
43
- 'metadata' => {
44
- 'metadata' => {
45
- 'external' => {
46
- 'id' => "#{args[:external_id]}"
47
- }
48
- }
49
- }
50
- })
51
- end
30
+ form_args = form_args(media_url, args[:language]) # language codes: en-US (default), en-UK, en-AU
31
+ form_args.merge! metadata(args[:external_id]) if args[:external_id]
52
32
 
53
33
  response = self.class.post(
54
34
  uri + '/media',
55
35
  headers: multipart_headers(headers),
56
36
  body: multipart_query(form_args)
57
37
  )
58
-
59
38
  VoiceBase::Response.new(response, api_version)
60
39
  end
61
40
 
@@ -137,6 +116,31 @@ module VoiceBase
137
116
 
138
117
  private
139
118
 
119
+ def form_args(media_url, language = nil)
120
+ args = {
121
+ 'media' => media_url,
122
+ 'configuration' => {
123
+ 'configuration' => {
124
+ 'executor' => 'v2'
125
+ }
126
+ }
127
+ }
128
+ args['configuration']['configuration'].merge!({'language' => language}) if language
129
+ args
130
+ end
131
+
132
+ def metadata(external_id)
133
+ {
134
+ 'metadata' => {
135
+ 'metadata' => {
136
+ 'external' => {
137
+ 'id' => external_id
138
+ }
139
+ }
140
+ }
141
+ }
142
+ end
143
+
140
144
  def blank?(value)
141
145
  value.nil? || value.empty?
142
146
  end
@@ -1,5 +1,5 @@
1
1
  module VoiceBase
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
 
4
4
  def self.version; VERSION; end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voicebase-client-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen Fesslmeier
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-06-01 00:00:00.000000000 Z
13
+ date: 2016-10-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler