Class: Bluedart::CancelPickup

Inherits:
Base
  • Object
show all
Defined in:
lib/bluedart/cancel_pickup.rb

Instance Method Summary collapse

Constructor Details

#initialize(details) ⇒ CancelPickup

Returns a new instance of CancelPickup.



3
4
5
6
7
# File 'lib/bluedart/cancel_pickup.rb', line 3

def initialize(details)
  @cancel_pickup_request_details = cancel_pickup_request_hash(details[:cancel_pickup_request])
  @profile = profile_hash({api_type: 'S', version: '1.3'}, details[:creds])
  @mode = details[:mode]
end

Instance Method Details

#request_urlObject



9
10
11
12
13
14
15
# File 'lib/bluedart/cancel_pickup.rb', line 9

def request_url
  if @mode == 'prod'
    'https://netconnect.bluedart.com/Ver1.8/ShippingAPI/Pickup/PickupRegistrationService.svc'
  else
    'https://netconnect.bluedart.com/Ver1.8/Demo/ShippingAPI/Pickup/PickupRegistrationService.svc'
  end
end

#responseObject



17
18
19
20
21
22
# File 'lib/bluedart/cancel_pickup.rb', line 17

def response
  wsa = 'http://tempuri.org/IPickupRegistration/CancelPickup'
  params = { 'request' => @cancel_pickup_request_details }
  opts = { message: 'CancelPickup', wsa: wsa, params: params, extra: { 'profile' => @profile }, url: request_url }
  make_request(opts)
end