class AsposeImagingCloud::ImagingRequest
Base class for requests with basic operations
Public Instance Methods
Source
# File lib/aspose-imaging-cloud/models/requests/imaging_request.rb, line 31 def to_http_info(config); end
Protected Instance Methods
Source
# File lib/aspose-imaging-cloud/models/requests/imaging_request.rb, line 38 def select_header_accept(accepts) return nil if accepts.nil? || accepts.empty? # use JSON when present, otherwise use all of the provided json_accept = accepts.find { |s| json_mime?(s) } json_accept || accepts.join(',') end
Return Accept header based on an array of accepts provided. @param [Array] accepts array for Accept @return [String] the Accept header (e.g. application/json)
Source
# File lib/aspose-imaging-cloud/models/requests/imaging_request.rb, line 49 def select_header_content_type(content_types) # use application/json by default return 'application/json' if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first end
Return Content-Type header based on an array of content types provided. @param [Array] content_types array for Content-Type @return [String] the Content-Type header (e.g. application/json)
Private Instance Methods
Source
# File lib/aspose-imaging-cloud/models/requests/imaging_request.rb, line 68 def json_mime?(mime) (mime == '*/*') || !(mime =~ %r{Application/.*json(?!p)(;.*)?}i).nil? end
Check if the given MIME is a JSON MIME. JSON MIME examples:
application/json application/json; charset=UTF8 APPLICATION/JSON */*
@param [String] mime MIME @return [Boolean] True if the MIME is application/json
Source
# File lib/aspose-imaging-cloud/models/requests/imaging_request.rb, line 90 def object_to_hash(obj) if obj.respond_to?(:to_hash) obj.to_hash else obj end end
Convert object(non-array) to hash. @param [Object] obj object to be converted into JSON string @return [String] JSON string representation of the object
Source
# File lib/aspose-imaging-cloud/models/requests/imaging_request.rb, line 75 def object_to_http_body(model) return model if model.nil? || model.is_a?(String) local_body = nil local_body = if model.is_a?(Array) model.map { |m| object_to_hash(m) } else object_to_hash(model) end local_body.to_json end
Convert object (array, hash, object, etc) to JSON string. @param [Object] model object to be converted into JSON string @return [String] JSON string representation of the object