Module: BeyondApi::ShopAddress

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

Instance Method Summary collapse

Instance Method Details

#addressOpenStruct

A GET request is used to retrieve the details of a shop’s address.

$ curl 'https://api-shop.beyondshop.cloud/api/shop/address' -i -X GET

Examples:

session.shop.address

Returns:

  • (OpenStruct)


17
18
19
20
21
# File 'lib/beyond_api/resources/shops/address.rb', line 17

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

  handle_response(response, status)
end

#update_address(body) ⇒ OpenStruct

A PATCH request is used to patch a shop’s address partially with json content type.

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

Examples:

body = {
  "city" => "Barcelona"
}

session.shop.update_address(body)

Parameters:

  • body (Hash)

    the request body

Returns:

  • (OpenStruct)

Scopes:

  • shad:u



47
48
49
50
51
# File 'lib/beyond_api/resources/shops/address.rb', line 47

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

  handle_response(response, status)
end