Class: Bluedart::PincodeService

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

Instance Method Summary collapse

Constructor Details

#initialize(details) ⇒ PincodeService

Returns a new instance of PincodeService.



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

def initialize(details)
  @pincode = details[:pincode]
  @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/pincode_service.rb', line 9

def request_url
  if @mode == 'prod'
    'http://netconnect.bluedart.com/Ver1.8/ShippingAPI/Finder/ServiceFinderQuery.svc'
  else
    'http://netconnect.bluedart.com/Ver1.8/Demo/ShippingAPI/Finder/ServiceFinderQuery.svc'
  end
end

#responseObject



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

def response
  wsa = 'http://tempuri.org/IServiceFinderQuery/GetServicesforPincode'
  opts = {message: 'GetServicesforPincode', wsa: wsa, params: {pinCode: @pincode}, extra: {'profile' => @profile}, url: request_url}
  make_request(opts)
end