honkster-encosion 0.3.3 → 0.3.4

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{honkster-encosion}
8
- s.version = "0.3.3"
8
+ s.version = "0.3.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rob Cameron"]
data/lib/encosion/base.rb CHANGED
@@ -86,7 +86,7 @@ module Encosion
86
86
  body = JSON.parse(response.body.content.strip)
87
87
  header = response.header
88
88
 
89
- error_check(header,body)
89
+ error_check(header, body)
90
90
  # if we get here then no exceptions were raised
91
91
  return body
92
92
  end
@@ -96,12 +96,15 @@ module Encosion
96
96
  def error_check(header,body)
97
97
  if header.status_code == 200
98
98
  return true if body.nil?
99
- # puts body['error']
100
- if body.has_key? 'error' && !body['error'].nil?
101
- message = "Brightcove responded with an error: #{body['error']} (code #{body['code']})"
99
+ error = body['error']
100
+
101
+ unless error.nil?
102
+ message = "#{body['error']["name"]}: #{body['error']["message"]} (code #{body['error']['code']})"
103
+
102
104
  body['errors'].each do |error|
103
105
  message += "\n#{error.values.first} (code #{error.values.last})"
104
106
  end if body.has_key? 'errors'
107
+
105
108
  raise BrightcoveException, message
106
109
  end
107
110
  else
@@ -242,7 +242,7 @@ module Encosion
242
242
  r[:encodingRate]
243
243
  end.sort.reverse.select { |rate| rate <= max_rate }.first
244
244
 
245
- urls[best_rate] || flv_url
245
+ urls[best_rate] || flv_url || urls.values.first
246
246
  end
247
247
 
248
248
  #
@@ -7,7 +7,7 @@ class EncosionTest < Test::Unit::TestCase
7
7
  Encosion.options[:read_token] = 'WZvNvOA-dhN8Q1VCBfJlAH1GNbk-fp48rG7r0LnRNvd1nuRvwJy6uw..'
8
8
  Encosion.options[:write_token] = 'UuVyFQ0u58r_1FBxTmmt1bp640RvkkOQjNK9UCBTFH2VW3DA2o_Itw..'
9
9
 
10
- p Encosion::Video.delete_by_reference_id("testvideo")
10
+ # p Encosion::Video.delete_by_reference_id("testvideo")
11
11
 
12
12
  new_video = Encosion::Video.new(
13
13
  :file => File.new("/home/honk/workspace/honkster-encosion/test/movie.mov"),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honkster-encosion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Cameron