Class: BeyondApi::Signers

Inherits:
Base
  • Object
show all
Includes:
Utils
Defined in:
lib/beyond_api/resources/signers.rb

Instance Attribute Summary

Attributes inherited from Base

#session

Instance Method Summary collapse

Methods included from Utils

#file_content_type, #handle_all_request, #handle_error, #handle_response, #sanitize_key, #sanitize_response, #to_object_struct

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from BeyondApi::Base

Instance Method Details

#allOpenStruct

A GET request is used to list all signers.

$ curl 'https://api-shop.beyondshop.cloud/api/signers' -i -X GET \
     H 'Accept: application/hal+json' \
     H 'Authorization: Bearer <Access token>'

Examples:

@signers = session.signers.all

Returns:

  • (OpenStruct)


21
22
23
24
25
26
27
28
# File 'lib/beyond_api/resources/signers.rb', line 21

def all
  path = "/signers"

  response, status = BeyondApi::Request.get(@session,
                                            path)

  handle_response(response, status)
end

#createOpenStruct

A POST request is used to create a signer. You cannot create more than five signers.

$ curl 'https://api-shop.beyondshop.cloud/api/signers' -i -X POST \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

@signer = session.signers.create

Returns:

  • (OpenStruct)


42
43
44
45
46
47
48
49
# File 'lib/beyond_api/resources/signers.rb', line 42

def create
  path = "/signers"

  response, status = BeyondApi::Request.post(@session,
                                             path)

  handle_response(response, status)
end

#delete(signer_id) ⇒ OpenStruct

A DELETE request is used to delete a signer. If at least one signer has been created, you cannot delete the last signer.

$ curl 'https://api-shop.beyondshop.cloud/api/signers/6bb72afd-340e-439a-9990-eef2e0883e1e' -i -X DELETE \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>'

Examples:

session.signers.delete("6bb72afd-340e-439a-9990-eef2e0883e1e")

Returns:

  • (OpenStruct)


63
64
65
66
67
68
69
70
# File 'lib/beyond_api/resources/signers.rb', line 63

def delete(signer_id)
  path = "/signers/#{signer_id}"

  response, status = BeyondApi::Request.delete(@session,
                                               path)

  handle_response(response, status, respond_with_true: true)
end