Class: Starling::Services::MerchantsService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/starling/services/merchants_service.rb

Overview

A service for accessing the Merchant API’s Get Merchant endpoint

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Starling::Services::BaseService

Instance Method Details

#get(id, params: {}, headers: {}) ⇒ Resources:MerchantResource

Parameters:

  • id (String)

    The Starling internal ID of the merchant

  • params (Hash) (defaults to: {})

    Parameters which will be included in the HTTP request, included in the URL as a query string

  • headers (Hash) (defaults to: {})

    Headers which be included in the HTTP request, merged on top of the headers set at the Client level

Returns:

  • (Resources:MerchantResource)

Raises:

  • (Errors::ApiError)

    if the HTTP request returns a status indicating that it was unsuccessful



13
14
15
16
17
# File 'lib/starling/services/merchants_service.rb', line 13

def get(id, params: {}, headers: {})
  response = api_service.make_request(:get, "/merchants/#{id}", params: params,
                                                                headers: headers)
  resource.new(response: response)
end