# frozen_string_literal: true module Files class EmailLog attr_reader :options, :attributes def initialize(attributes = {}, options = {}) @attributes = attributes || {} @options = options || {} end # date-time - Start Time of Action def timestamp @attributes[:timestamp] end # string - Log Message def message @attributes[:message] end # string - Status of E-Mail delivery def status @attributes[:status] end # string - Subject line of E-Mail def subject @attributes[:subject] end # string - To field of E-Mail def to @attributes[:to] end # string - CC field of E-Mail def cc @attributes[:cc] end # string - How was email deliered? `customer_smtp` or `files.com` def delivery_method @attributes[:delivery_method] end # string - Customer SMTP Hostname used. def smtp_hostname @attributes[:smtp_hostname] end # string - Customer SMTP IP address as resolved for use (useful for troubleshooting DNS issues with customer SMTP). def smtp_ip @attributes[:smtp_ip] end # Parameters: # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination. # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). # action - string # page - int64 # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `start_date`, `end_date` or `status`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ status ]`, `[ start_date, end_date ]`, `[ start_date, status ]` or `[ end_date, status ]`. # filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `status`. Valid field combinations are `[ start_date ]`, `[ end_date ]`, `[ status ]`, `[ start_date, end_date ]`, `[ start_date, status ]` or `[ end_date, status ]`. def self.list(params = {}, options = {}) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: action must be an String") if params[:action] and !params[:action].is_a?(String) raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params[:page] and !params[:page].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if params[:filter_prefix] and !params[:filter_prefix].is_a?(Hash) List.new(EmailLog, params) do Api.send_request("/email_logs", :get, params, options) end end def self.all(params = {}, options = {}) list(params, options) end end end