Class: ShellSmartPayApi::StationLocatorController

Inherits:
BaseController show all
Defined in:
lib/shell_smart_pay_api/controllers/station_locator_controller.rb

Overview

StationLocatorController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from ShellSmartPayApi::BaseController

Instance Method Details

#stationlocator_v1_stations_get_around_location(m, lon, lat, radius, offer_code: nil, n: nil, amenities: nil, countries: nil, type: nil) ⇒ AroundLocationArray

Returns all sites within specified radius of specified GPS location. Sites of all Types are returned. This call must be used when attempting to establish the station the user is located at as part of fuelling journey (i.e. user has to be within 300m of station to be considered located at the station). This API could also be used as a general query to find nearby Shell locations kilometers specify locations that will honour the specified (advanced) offer code number of locations that are returned and defaulted to a maximum of 250 locations. Locations returned based on distance to User’s location as-the-crow-flies. requestor to filter locations based on one or more amenities (e.g. Filter locations so that only those with a Toilet are returned). requestor to filter locations based on one or more Countries (i.e. by country codes). least one Type, indicating whether it is Shell-branded or not, and if the station can be used by trucks. Note that a station can have more than one Type (e.g. Shell retail sites (Type=0) can also be truck friendly (Type=2)). Type values are as follows: * 0 = Shell owned/branded stations that are not also Type=2 or Type=3 * 1 = Partner stations accepting Shell Card * 2 = Shell owned/branded stations that are truck friendly but not Type=3 * 3 = Shell owned/branded stations that are truck only <br/>**When type is not provided, API will return type 0 and 2 only.**

Parameters:

  • m (String)

    Required parameter: API Method to be executed

  • lon (Float)

    Required parameter: The user’s current longitude

  • lat (Float)

    Required parameter: The user’s current latitude

  • radius (Float)

    Required parameter: The search radius in

  • offer_code (String) (defaults to: nil)

    Optional parameter: This enables requestor to

  • n (Integer) (defaults to: nil)

    Optional parameter: This enables requestor to limit the

  • amenities (Array[String]) (defaults to: nil)

    Optional parameter: This enables

  • countries (Array[String]) (defaults to: nil)

    Optional parameter: This enables

  • type (TypeEnum) (defaults to: nil)

    Optional parameter: All fuel stations are of at

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/shell_smart_pay_api/controllers/station_locator_controller.rb', line 43

def stationlocator_v1_stations_get_around_location(m,
                                                   lon,
                                                   lat,
                                                   radius,
                                                   offer_code: nil,
                                                   n: nil,
                                                   amenities: nil,
                                                   countries: nil,
                                                   type: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/SiteData/v1/stations',
                                 Server::SHELL)
               .query_param(new_parameter(m, key: 'm'))
               .query_param(new_parameter(lon, key: 'lon'))
               .query_param(new_parameter(lat, key: 'lat'))
               .query_param(new_parameter(radius, key: 'radius'))
               .query_param(new_parameter(offer_code, key: 'offer_code'))
               .query_param(new_parameter(n, key: 'n'))
               .query_param(new_parameter(amenities, key: 'amenities'))
               .query_param(new_parameter(countries, key: 'countries'))
               .query_param(new_parameter(type, key: 'type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuthTokenPost')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AroundLocationArray.method(:from_hash))
                .local_error('400',
                             'Bad request',
                             StationLocatorBadRequestException)
                .local_error('401',
                             'Unauthorized',
                             StationLocatorUnauthorizedException)
                .local_error('403',
                             'Forbbiden',
                             StationLocatorForbiddenException)
                .local_error('404',
                             'Not Found',
                             StationLocatorNotFoundException)
                .local_error('500',
                             'Internal Server Error',
                             StationLocatorInternalServerErrorException))
    .execute
end