Class: Fosdick::Sender

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/fosdick/sender.rb

Class Method Summary collapse

Class Method Details

.send_doc(doc, config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fosdick/sender.rb', line 7

def self.send_doc(doc, config)
  client = config['client_name']

  begin
    # required sleep 2 sec for Fosdick Shopping Cart iPost interface
    sleep 2
    res  = post("/#{client}/cart/ipost.asp", body: doc)
  rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
         Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError

    raise Fosdick::SendError
  end
  return validate_and_return(res)
end