Module: BeyondApi::ShopLegals

Included in:
Shop
Defined in:
lib/beyond_api/resources/shops/legals.rb

Instance Method Summary collapse

Instance Method Details

A GET request is used to retrieve a specific part of the legal content information.

$ curl 'https://api-shop.beyondshop.cloud/api/legal-content/right-of-withdrawal' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json'

Examples:

@legal_content = session.shop.legal_content("right-of-withdrawal")

Parameters:

  • legal_content_type (String)

    the legal content type

Returns:

  • (OpenStruct)


21
22
23
24
25
26
# File 'lib/beyond_api/resources/shops/legals.rb', line 21

def legal_content(legal_content_type)
  response, status = BeyondApi::Request.get(@session,
                                            "/legal-content/#{legal_content_type}")

  handle_response(response, status)
end

A GET request is used to retrieve the legal content of a shop.

$ curl 'https://api-shop.beyondshop.cloud/api/legal-content' -i -X GET \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json'

Examples:

@legal_content = session.shop.legal_contents(size: 5, page: 1)

Parameters:

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

    a customizable set of options

Options Hash (params):

  • :size (Integer)

    the page size

  • :page (Integer)

    the page number

Returns:

  • (OpenStruct)


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

def legal_contents(params = {})
  response, status = BeyondApi::Request.get(@session,
                                            "/legal-content",
                                            params)

  handle_response(response, status)
end

A GET request is used to retrieve the details of the legal resource.

$ curl 'https://api-shop.beyondshop.cloud/api/shop/legal' -i -X GET \
    -H 'Authorization: Bearer <Access token>'

Examples:

@legal_details = session.shop.legal_details

Returns:

  • (OpenStruct)

Scopes:

  • legl:r



64
65
66
67
68
69
# File 'lib/beyond_api/resources/shops/legals.rb', line 64

def legal_details
  response, status = BeyondApi::Request.get(@session,
                                            "/shop/legal")

  handle_response(response, status)
end

A PUT request is used to update the content of a specific part of the legal content information. Changes on the properties type and mandatory will be ignored.

$ curl 'https://api-shop.beyondshop.cloud/api/legal-content/legal-notice' -i -X PUT \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
  "content" : "new legal content"
}'

Examples:

session.shop.update_legal_content(body)

Parameters:

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • lcnt:u



91
92
93
94
95
96
97
# File 'lib/beyond_api/resources/shops/legals.rb', line 91

def update_legal_content(body)
  response, status = BeyondApi::Request.put(@session,
                                            "/legal-content/legal-notice",
                                            body)

  handle_response(response, status)
end

A PATCH request is used to update a legal resource partially with json content type.

$ curl 'https://api-shop.beyondshop.cloud/api/shop/legal' -i -X PATCH \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/hal+json' \
    -H 'Authorization: Bearer <Access token>' \
    -d '{
  "vatId" : "GB 111111111"
}'

Examples:

body = {
  "vat_id" => "GB 111111111"
}

session.shop.update_legal_details(body)

Parameters:

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • legl:u



123
124
125
126
127
128
129
# File 'lib/beyond_api/resources/shops/legals.rb', line 123

def update_legal_details(body)
  response, status = BeyondApi::Request.patch(@session,
                                              "/shop/legal",
                                              body)

  handle_response(response, status)
end