class AsposeEmailCloud::EmailRequest
Base class for requests with basic operations
Public Class Methods
select_header_accept(accepts)
click to toggle source
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)
# File lib/aspose-email-cloud/models/email_request.rb, line 36 def self.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| EmailRequest.json_mime?(s) } json_accept || accepts.join(',') end
select_header_content_type(content_types)
click to toggle source
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)
# File lib/aspose-email-cloud/models/email_request.rb, line 47 def self.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| EmailRequest.json_mime?(s) } json_content_type || content_types.first end
Private Class Methods
json_mime?(mime)
click to toggle source
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
# File lib/aspose-email-cloud/models/email_request.rb, line 66 def self.json_mime?(mime) (mime == '*/*') || !(mime =~ %r{Application/.*json(?!p)(;.*)?}i).nil? end
Public Instance Methods
to_http_info(config)
click to toggle source
# File lib/aspose-email-cloud/models/email_request.rb, line 31 def to_http_info(config); end