• Namespace
  • Class

Namespaces

  • Klarna
    • Exceptions
    • Rest
      • Checkout
      • CustomerToken
      • HostedPaymentPage
      • InstantShopping
      • MerchantCardService
      • OrderManagement
      • Payments
      • Settlements
      • Transport
        • Exception

Classes

  • Resource

Class Resource

Abstract resource class.

ArrayObject implements IteratorAggregate, Traversable, ArrayAccess, Serializable, Countable
Extended by Klarna\Rest\Resource

Direct known subclasses

Klarna\Rest\Checkout\Order, Klarna\Rest\CustomerToken\Tokens, Klarna\Rest\Payments\Sessions, Klarna\Rest\Settlements\Payouts, Klarna\Rest\Settlements\Reports, Klarna\Rest\Settlements\Transactions, Klarna\Rest\HostedPaymentPage\Sessions, Klarna\Rest\InstantShopping\ButtonKeys, Klarna\Rest\InstantShopping\Orders, Klarna\Rest\MerchantCardService\VCCSettlements, Klarna\Rest\OrderManagement\Capture, Klarna\Rest\OrderManagement\Order, Klarna\Rest\OrderManagement\Refund, Klarna\Rest\Payments\Orders

Abstract
Namespace: Klarna\Rest
Located at Klarna/Rest/Resource.php

Methods summary

public
# __construct( Klarna\Rest\Transport\ConnectorInterface $connector )

Constructs a resource instance.

Constructs a resource instance.

Parameters

$connector
HTTP transport instance.

Overrides

ArrayObject::__construct
public string|null
# getId( )

Gets the resource id.

Gets the resource id.

Returns

string|null
public string|null
# getLocation( )

Gets the resource location.

Gets the resource location.

Returns

string|null
public Klarna\Rest\Resource
# setLocation( string $url )

Sets the resource location.

Sets the resource location.

Parameters

$url
Url to the resource

Returns

Klarna\Rest\Resource
public
# exchangeArray( array $array )

Overrides: Stores the ID KEY field in order to restore it after exchanging the array without the ID field.

Overrides: Stores the ID KEY field in order to restore it after exchanging the array without the ID field.

Parameters

$array
Data to be exchanged

Overrides

ArrayObject::exchangeArray
public Klarna\Rest\Resource
# fetch( )

Fetches the resource.

Fetches the resource.

Returns

Klarna\Rest\Resource

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
RuntimeException
On an unexpected API response
RuntimeException
If the response content type is not JSON
InvalidArgumentException
If the JSON cannot be parsed
LogicException
When Guzzle cannot populate the response
protected Klarna\Rest\Resource
# setId( mixed $id )

Sets new ID KEY field.

Sets new ID KEY field.

Parameters

$id
ID field

Returns

Klarna\Rest\Resource
protected Klarna\Rest\Transport\ResponseValidator
# request( string $method, string $url, array $headers = [], string $body = null )

Sends a HTTP request to the specified url.

Sends a HTTP request to the specified url.

Parameters

$method
HTTP method, e.g. 'GET'
$url
Request destination
$headers
$body

Returns

Klarna\Rest\Transport\ResponseValidator
When the API replies with an error response

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
LogicException
When Guzzle cannot populate the response'
protected Klarna\Rest\Transport\ResponseValidator
# get( string $url )

Sends a HTTP GET request to the specified url.

Sends a HTTP GET request to the specified url.

Parameters

$url
Request destination

Returns

Klarna\Rest\Transport\ResponseValidator

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
LogicException
When Guzzle cannot populate the response
protected Klarna\Rest\Transport\ResponseValidator
# delete( string $url, array $data = null )

Sends a HTTP DELETE request to the specified url.

Sends a HTTP DELETE request to the specified url.

Parameters

$url
Request destination
$data
Data to be JSON encoded

Returns

Klarna\Rest\Transport\ResponseValidator

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
LogicException
When Guzzle cannot populate the response
protected Klarna\Rest\Transport\ResponseValidator
# patch( string $url, array $data )

Sends a HTTP PATCH request to the specified url.

Sends a HTTP PATCH request to the specified url.

Parameters

$url
Request destination
$data
Data to be JSON encoded

Returns

Klarna\Rest\Transport\ResponseValidator

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
LogicException
When Guzzle cannot populate the response
protected Klarna\Rest\Transport\ResponseValidator
# put( string $url, array $data )

Sends a HTTP PUT request to the specified url.

Sends a HTTP PUT request to the specified url.

Parameters

$url
Request destination
$data
Data to be JSON encoded

Returns

Klarna\Rest\Transport\ResponseValidator

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
LogicException
When Guzzle cannot populate the response
protected Klarna\Rest\Transport\ResponseValidator
# post( string $url, array $data = null )

Sends a HTTP POST request to the specified url.

Sends a HTTP POST request to the specified url.

Parameters

$url
Request destination
$data
Data to be JSON encoded

Returns

Klarna\Rest\Transport\ResponseValidator

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
LogicException
When Guzzle cannot populate the response

Methods inherited from ArrayObject

append(), asort(), count(), getArrayCopy(), getFlags(), getIterator(), getIteratorClass(), ksort(), natcasesort(), natsort(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), serialize(), setFlags(), setIteratorClass(), uasort(), uksort(), unserialize()

Magic methods summary

Constants summary

string ID_FIELD

Id property field name.

Id property field name.

# 'id'

Constants inherited from ArrayObject

ARRAY_AS_PROPS, STD_PROP_LIST

Properties summary

public static string $path

Path to the resource endpoint.

Path to the resource endpoint.

#
protected Connector $connector

HTTP transport connector instance.

HTTP transport connector instance.

#
protected string $url

Url to the resource.

Url to the resource.

#
API documentation generated by ApiGen