response = RestClient::Request.new({
method: :post,
url: 'https://infovijay.com,
user: 'vijay',
password: 'dr12345',
payload: { key1: 'value1', key2: 'value2' },
headers: { :accept => :json, content_type: :json }
}).execute do |response, request, result|
case response.code
when 400
[ :error, parse_json(response.to_str) ]
when 200
[ :success, parse_json(response.to_str) ]
else
fail "#{response.to_str}."
end
end
method: :post,
url: 'https://infovijay.com,
user: 'vijay',
password: 'dr12345',
payload: { key1: 'value1', key2: 'value2' },
headers: { :accept => :json, content_type: :json }
}).execute do |response, request, result|
case response.code
when 400
[ :error, parse_json(response.to_str) ]
when 200
[ :success, parse_json(response.to_str) ]
else
fail "#{response.to_str}."
end
end
1 comment:
It seems you are a computer geek. Keep it up.
Post a Comment