Sha256: 3b5ff8f573166c4befc00e99157f6f666c0c4241f90398b4bb31c185298ae25a
Contents?: true
Size: 1.13 KB
Versions: 8
Compression:
Stored size: 1.13 KB
Contents
class FlixCloud::Record attr_accessor :errors def initialize(attrs={}) self.errors = [] self.attributes = attrs end def attributes=(attrs) attrs.each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end def self.record_column(attribute, klass) eval %{ attr_reader :#{attribute} def #{attribute}=(value) if @#{attribute} @#{attribute}.attributes = value else @#{attribute} = FlixCloud::#{klass}.new(value) end end } end protected def post(path, body) begin FlixCloud::Response.new(HttpClient::Resource.new("https://flixcloud.com/#{path}", :verify_ssl => OpenSSL::SSL::VERIFY_PEER).post(body, :content_type => 'application/xml', :accept => 'application/xml')) rescue HttpClient::ServerBrokeConnection raise FlixCloud::ServerBrokeConnection, $!.message rescue HttpClient::RequestTimeout raise FlixCloud::RequestTimeout, $!.message rescue HttpClient::ConnectionRefused raise FlixCloud::ConnectionRefused, $!.message end end end
Version data entries
8 entries across 8 versions & 3 rubygems