Class: Zencoder

Inherits:
Object
  • Object
show all
Defined in:
lib/zencoder/http/net_http.rb,
lib/zencoder/job.rb,
lib/zencoder/http.rb,
lib/zencoder/errors.rb,
lib/zencoder/output.rb,
lib/zencoder/account.rb,
lib/zencoder/version.rb,
lib/zencoder/response.rb,
lib/zencoder/zencoder.rb,
lib/zencoder/notification.rb,
lib/zencoder/http/typhoeus.rb

Overview

Ruby’s Net/HTTP Sucks Borrowed root cert checking from redcorundum.blogspot.com/2008/03/ssl-certificates-and-nethttps.html

Direct Known Subclasses

Account, HTTP, Job, Notification, Output, Response

Defined Under Namespace

Classes: Account, Error, HTTP, HTTPError, Job, Notification, Output, Response

Constant Summary collapse

VERSION =
'2.1.6'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.decode(content, format = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/zencoder/zencoder.rb', line 22

def self.decode(content, format=nil)
  if content.is_a?(String)
    if format.to_s == 'xml'
      Hash.from_xml(content)
    else
      ActiveSupport::JSON.decode(content)
    end
  else
    content
  end
end

.encode(content, format = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/zencoder/zencoder.rb', line 8

def self.encode(content, format=nil)
  if content.is_a?(String)
    content
  elsif format.to_s == 'xml'
    content.to_xml
  else
    content.to_json
  end
end

Instance Method Details

#decode(content, format = nil) ⇒ Object



34
35
36
# File 'lib/zencoder/zencoder.rb', line 34

def decode(content, format=nil)
  self.class.decode(content, format)
end

#encode(content, format = nil) ⇒ Object



18
19
20
# File 'lib/zencoder/zencoder.rb', line 18

def encode(content, format=nil)
  self.class.encode(content, format)
end