def send_message(working_domain, data)
      if test_mode? then
        Mailgun::Client.deliveries << data
        return Response.from_hash(
          {
            :body => '{"id": "test-mode-mail@localhost", "message": "Queued. Thank you."}',
            :code => 200,
          }
        )
      end

      case data
      when Hash
        # Remove nil values from the data hash
        # Submitting nils to the API will likely cause an error.
        #  See also: https://github.com/mailgun/mailgun-ruby/issues/32
        data = data.select { |k, v| v != nil }

        if data.key?(:message)
          if data[:message].is_a?(String)
            data[:message] = convert_string_to_file(data[:message])
          end
          return post("#{working_domain}/messages.mime", data)
        end
        post("#{working_domain}/messages", data)
      when MessageBuilder
        post("#{working_domain}/messages", data.message)
      else
        fail ParameterError.new('Unknown data type for data parameter.', data)
      end
    end
def send_message(working_domain, data)
      if test_mode? then
        Mailgun::Client.deliveries << data
        return Response.from_hash(
          {
            :body => '{"id": "test-mode-mail@localhost", "message": "Queued. Thank you."}',
            :code => 200,
          }
        )
      end

      case data
      when Hash
        # Remove nil values from the data hash
        # Submitting nils to the API will likely cause an error.
        #  See also: https://github.com/mailgun/mailgun-ruby/issues/32
        data = data.select { |k, v| v != nil }

        if data.key?(:message)
          if data[:message].is_a?(String)
            data[:message] = convert_string_to_file(data[:message])
          end
          return post("#{working_domain}/messages.mime", data)
        end
        post("#{working_domain}/messages", data)
      when MessageBuilder
        post("#{working_domain}/messages", data.message)
      else
        fail ParameterError.new('Unknown data type for data parameter.', data)
      end
    end
Simple Message Sending

 @param [String] working_domain This is the domain you wish to send from.
 @param [Hash] data This should be a standard Hash
 containing required parameters for the requested resource.
 @return [Mailgun::Response] A Mailgun::Response object.