lib/postageapp/request.rb
# Skipping resend doesn't trigger PostageApp::FailedRequest.resend_all
# it's needed so the request being resend doesn't create duplicate queue
Skipping resend doesn't trigger PostageApp::FailedRequest.resend_all
it's needed so the request being resend doesn't create duplicate queue
Skipping resend doesn ' t trigger PostageApp :: FailedRequest . resend_all it ' s needed so the request being resend doesn ' t create duplicate queue
def send(skip_failed_requests_processing = false)
    http = PostageApp.configuration.http
    PostageApp.logger.info(self)
    if (ENV['DEBUG'])
      puts "// #{url}"
      puts JSON.pretty_generate(self.arguments_to_send)
    end
    http_response =
      begin
        http.post(
          url.path, 
          self.arguments_to_send.to_json, 
          HEADERS_DEFAULT.merge(
            'User-Agent' => self.class.user_agent
          )
        )
      rescue TimeoutError, Errno::ECONNREFUSED => e
        e
      end
    response = PostageApp::Response.new(http_response)
    PostageApp.logger.info(response)
    unless (skip_failed_requests_processing)
      if (response.fail?)
        PostageApp::FailedRequest.store(self)
      elsif (response.ok?)
        PostageApp::FailedRequest.resend_all
      end
    end
    response
  end
def send ( skip_failed_requests_processing = false ) http = PostageApp . configuration . http PostageApp . logger . info ( self ) if ( ENV [ 'DEBUG' ] ) puts "// #{url}" puts JSON . pretty_generate ( self . arguments_to_send ) end http_response = begin http . post ( url . path , self . arguments_to_send . to_json , HEADERS_DEFAULT . merge ( 'User-Agent' => self . class . user_agent ) ) rescue TimeoutError , Errno :: ECONNREFUSED => e e end response = PostageApp :: Response . new ( http_response ) PostageApp . logger . info ( response ) unless ( skip_failed_requests_processing ) if ( response . fail? ) PostageApp :: FailedRequest . store ( self ) elsif ( response . ok? ) PostageApp :: FailedRequest . resend_all end end response end
Skipping resend doesn't trigger PostageApp::FailedRequest.resend_all
it's needed so the request being resend doesn't create duplicate queue
Skipping resend doesn ' t trigger PostageApp :: FailedRequest . resend_all it ' s needed so the request being resend doesn ' t create duplicate queue
skip_failed_requests_processing