Class: Worldline::Connect::SDK::V1::Merchant::Hostedcheckouts::HostedcheckoutsClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/worldline/connect/sdk/v1/merchant/hostedcheckouts/hostedcheckouts_client.rb

Overview

Hostedcheckouts client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ HostedcheckoutsClient

Returns a new instance of HostedcheckoutsClient.

Parameters:



23
24
25
# File 'lib/worldline/connect/sdk/v1/merchant/hostedcheckouts/hostedcheckouts_client.rb', line 23

def initialize(parent, path_context)
  super(parent: parent, path_context: path_context)
end

Instance Method Details

#create(body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::CreateHostedCheckoutResponse

Resource /{merchantId}/hostedcheckouts - Create hosted checkout

Parameters:

Returns:

Raises:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/worldline/connect/sdk/v1/merchant/hostedcheckouts/hostedcheckouts_client.rb', line 41

def create(body, context = nil)
  uri = instantiate_uri('/v1/{merchantId}/hostedcheckouts', nil)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::CreateHostedCheckoutResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#delete(hosted_checkout_id, context = nil) ⇒ Object

Resource /{merchantId}/hostedcheckouts/{hostedCheckoutId} - Delete hosted checkout

Parameters:

Raises:



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/worldline/connect/sdk/v1/merchant/hostedcheckouts/hostedcheckouts_client.rb', line 100

def delete(hosted_checkout_id, context = nil)
  path_context = {
    'hostedCheckoutId'.freeze => hosted_checkout_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/hostedcheckouts/{hostedCheckoutId}', path_context)
  @communicator.delete(
    uri,
    client_headers,
    nil,
    nil,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#get(hosted_checkout_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::GetHostedCheckoutResponse

Resource /{merchantId}/hostedcheckouts/{hostedCheckoutId} - Get hosted checkout status

Parameters:

Returns:

Raises:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/worldline/connect/sdk/v1/merchant/hostedcheckouts/hostedcheckouts_client.rb', line 70

def get(hosted_checkout_id, context = nil)
  path_context = {
    'hostedCheckoutId'.freeze => hosted_checkout_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/hostedcheckouts/{hostedCheckoutId}', path_context)
  @communicator.get(
    uri,
    client_headers,
    nil,
    Worldline::Connect::SDK::V1::Domain::GetHostedCheckoutResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end