Class: MethodRuby::Resources::Merchants

Inherits:
Object
  • Object
show all
Defined in:
lib/method_ruby/resources/merchants.rb

Overview

Merchant directory

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Merchants

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Merchants.

Parameters:



71
72
73
# File 'lib/method_ruby/resources/merchants.rb', line 71

def initialize(client:)
  @client = client
end

Instance Method Details

#list(method_version:, name: nil, type: nil, request_options: {}) ⇒ MethodRuby::Models::MerchantListResponse

Some parameter documentations has been truncated, see Models::MerchantListParams for more details.

Returns a list of merchants from the Method merchant directory.

Parameters:

Returns:

See Also:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/method_ruby/resources/merchants.rb', line 53

def list(params)
  query_params = [:name, :type]
  parsed, options = MethodRuby::MerchantListParams.dump_request(params)
  query = MethodRuby::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "merchants",
    query: query,
    headers: parsed.except(*query_params).transform_keys(method_version: "method-version"),
    model: MethodRuby::Models::MerchantListResponse,
    security: {secret_key: true},
    options: options
  )
end

#retrieve(mch_id, method_version:, request_options: {}) ⇒ MethodRuby::Models::MerchantRetrieveResponse

Some parameter documentations has been truncated, see Models::MerchantRetrieveParams for more details.

Returns a single merchant by its identifier.

Parameters:

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/method_ruby/resources/merchants.rb', line 23

def retrieve(mch_id, params)
  parsed, options = MethodRuby::MerchantRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["merchants/%1$s", mch_id],
    headers: parsed.transform_keys(method_version: "method-version"),
    model: MethodRuby::Models::MerchantRetrieveResponse,
    security: {secret_key: true},
    options: options
  )
end