cielo24 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 827188b8e97e031a14d9c4923c44f73c80f2e1bb
4
- data.tar.gz: 858f74b9cb08ef0e3ac3a6232e3e19091ae7a5a9
3
+ metadata.gz: 53e31a6d1a427f035275f3a67c69dd29b4f985cb
4
+ data.tar.gz: e51be163b5ac729a3ab6d41651968df9cd801705
5
5
  SHA512:
6
- metadata.gz: f0ec27fdb903e3765e905e5ae7557b68739e11017c820cb94e3cb046a9670e7fb9c5f6a13ae04b5bca87f1ff843cd24134573e2f576df01567fe99845115edb0
7
- data.tar.gz: 3ce8a723d3e9c8e3662b5e0c5d985d6f1cd92ebdf27c03e1b7f34489919c08872d784a257bed9f82ac69b55cdfffdcb80991a00c06fe379fd2165e0117e87d79
6
+ metadata.gz: b4ee8286682127ad776994309e08b2cc34ca2218a65e1f6a60ace77dd2f3dd0e7d0ebc8a2293a611550332b3c6ea183dd338ef1ef359afe9846c77e6f9bfb077
7
+ data.tar.gz: b3fbdfe72374bb683eb75cb5e742c7523a37b4952b7afb135cd9f4e26144296ff8bc0167f3095ced9a253af449312afc6e99a2e715dbe7b673bf5ea31b6b60c1
@@ -76,7 +76,7 @@ module Cielo24
76
76
  WebUtils.http_request(@base_url + UPDATE_PASSWORD_PATH, 'POST', WebUtils::BASIC_TIMEOUT, nil, nil, query_hash)
77
77
  end
78
78
 
79
- def generate_api_key(api_token, username, force_new = false)
79
+ def generate_api_key(api_token, username, force_new=false)
80
80
  assert_argument(username, "Username")
81
81
  assert_argument(api_token, "API Token")
82
82
  query_hash = init_access_req_dict(api_token)
@@ -97,7 +97,7 @@ module Cielo24
97
97
 
98
98
  ### JOB CONTROL ###
99
99
 
100
- def create_job(api_token, job_name = nil, source_language = "en")
100
+ def create_job(api_token, job_name=nil, source_language="en")
101
101
  query_hash = init_access_req_dict(api_token)
102
102
  query_hash[:job_name] = job_name if !(job_name.nil?)
103
103
  query_hash[:source_language] = source_language
@@ -144,11 +144,11 @@ module Cielo24
144
144
  end
145
145
 
146
146
  def add_media_to_job_url(api_token, job_id, media_url)
147
- return send_media_url(api_token, job_id, media_url, ADD_MEDIA_TO_JOB_PATH);
147
+ return send_media_url(api_token, job_id, media_url, ADD_MEDIA_TO_JOB_PATH)
148
148
  end
149
149
 
150
150
  def add_media_to_job_embedded(api_token, job_id, media_url)
151
- return send_media_url(api_token, job_id, media_url, ADD_EMBEDDED_MEDIA_TO_JOB_PATH);
151
+ return send_media_url(api_token, job_id, media_url, ADD_EMBEDDED_MEDIA_TO_JOB_PATH)
152
152
  end
153
153
 
154
154
  def send_media_url(api_token, job_id, media_url, path)
@@ -163,9 +163,7 @@ module Cielo24
163
163
 
164
164
  def get_media(api_token, job_id)
165
165
  query_hash = init_job_req_dict(api_token, job_id)
166
-
167
166
  json = WebUtils.get_json(@base_url + GET_MEDIA_PATH, 'GET', WebUtils::BASIC_TIMEOUT, query_hash)
168
-
169
167
  return json["MediaUrl"]
170
168
  end
171
169
 
@@ -173,9 +171,9 @@ module Cielo24
173
171
  job_id,
174
172
  fidelity,
175
173
  priority,
176
- callback_uri = nil,
177
- turnaround_hours = nil,
178
- target_language = nil,
174
+ callback_uri=nil,
175
+ turnaround_hours=nil,
176
+ target_language=nil,
179
177
  options = nil)
180
178
  assert_argument(fidelity, "Fidelity")
181
179
  assert_argument(priority, "Priority")
@@ -191,21 +189,20 @@ module Cielo24
191
189
  return json["TaskId"]
192
190
  end
193
191
 
194
- def get_transcript(api_token, job_id, transcript_options = nil)
192
+ def get_transcript(api_token, job_id, transcript_options=nil)
195
193
  query_hash = init_job_req_dict(api_token, job_id)
196
194
  query_hash.merge!(transcript_options.get_hash) if !(transcript_options.nil?)
197
-
198
195
  # Return raw transcript text
199
196
  return WebUtils.http_request(@base_url + GET_TRANSCRIPTION_PATH, 'GET', WebUtils::DOWNLOAD_TIMEOUT, query_hash)
200
197
  end
201
198
 
202
- def get_caption(api_token, job_id, caption_format, caption_options = nil)
199
+ def get_caption(api_token, job_id, caption_format, caption_options=nil)
203
200
  query_hash = init_job_req_dict(api_token, job_id)
204
201
  query_hash[:caption_format] = caption_format
205
202
  query_hash.merge!(caption_options.get_hash) if !(caption_options.nil?)
206
203
 
207
204
  response = WebUtils.http_request(@base_url + GET_CAPTION_PATH, 'GET', WebUtils::DOWNLOAD_TIMEOUT, query_hash)
208
- if(!caption_options.nil? and caption_options[:build_url]) # If build_url is true
205
+ if(!caption_options.nil? and caption_options.build_url) # If build_url is true
209
206
  return JSON.parse(response)["CaptionUrl"]
210
207
  else
211
208
  return response # Else return raw caption text
@@ -214,17 +211,14 @@ module Cielo24
214
211
 
215
212
  def get_element_list(api_token, job_id)
216
213
  query_hash = init_job_req_dict(api_token, job_id)
217
-
218
214
  json = WebUtils.get_json(@base_url + GET_ELEMENT_LIST_PATH, 'GET', WebUtils::BASIC_TIMEOUT, query_hash)
219
215
  return Mash.new(json)
220
216
  end
221
217
 
222
218
  def get_list_of_element_lists(api_token, job_id)
223
219
  query_hash = init_job_req_dict(api_token, job_id)
224
-
225
- response = WebUtils.http_request(@base_url + GET_LIST_OF_ELEMENT_LISTS_PATH, 'GET', WebUtils::BASIC_TIMEOUT, query_hash)
226
- array = JSON.parse(response)
227
- return array
220
+ json = WebUtils.get_json(@base_url + GET_LIST_OF_ELEMENT_LISTS_PATH, 'GET', WebUtils::BASIC_TIMEOUT, query_hash)
221
+ return json
228
222
  end
229
223
 
230
224
  ### PRIVATE HELPER METHODS ###
@@ -1,5 +1,5 @@
1
1
  module Cielo24
2
- class Options
2
+ class BaseOptions
3
3
 
4
4
  def get_hash
5
5
  hash = {}
@@ -14,11 +14,9 @@ module Cielo24
14
14
 
15
15
  def to_query
16
16
  hash = get_hash
17
- array = Array.new(hash.length)
18
- counter = 0
17
+ array = Array.new()
19
18
  hash.each do |key, value|
20
- array[counter] = key + '=' + value.to_s
21
- counter += 1
19
+ array.push(key + '=' + value.to_s)
22
20
  end
23
21
  return array.join("&")
24
22
  end
@@ -40,7 +38,7 @@ module Cielo24
40
38
  end
41
39
  end
42
40
 
43
- class CommonOptions < Options
41
+ class CommonOptions < BaseOptions
44
42
 
45
43
  attr_accessor :characters_per_caption_line
46
44
  attr_accessor :elementlist_version
@@ -153,7 +151,7 @@ module Cielo24
153
151
  end
154
152
  end
155
153
 
156
- class PerformTranscriptionOptions < Options
154
+ class PerformTranscriptionOptions < BaseOptions
157
155
 
158
156
  attr_accessor :customer_approval_steps
159
157
  attr_accessor :customer_approval_tool
@@ -1,3 +1,3 @@
1
1
  module Cielo24
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -6,7 +6,6 @@ module Cielo24
6
6
  require 'timeout'
7
7
  include JSON
8
8
 
9
- VERIFY_MODE = nil
10
9
  BASIC_TIMEOUT = 60 # seconds
11
10
  DOWNLOAD_TIMEOUT = 300 # seconds
12
11
  @@LAST_URL = "none" # For logging purposes
@@ -20,7 +19,7 @@ module Cielo24
20
19
  return JSON.parse(response)
21
20
  end
22
21
 
23
- def self.http_request(uri, method, timeout, query=nil, headers = nil, body = nil)
22
+ def self.http_request(uri, method, timeout, query=nil, headers=nil, body=nil)
24
23
  http_client = HTTPClient.new
25
24
  http_client.cookie_manager = nil
26
25
  http_client.send_timeout = 60*60*24*7 # HTTPClient default timeout set to 7 days, our own timeout handler is down below
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cielo24
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - cielo24
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-28 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler