Class: BeyondApi::Shop
- Includes:
- ShopAddress, ShopAttributes, ShopImages, ShopLegals, ShopLocations, Utils
- Defined in:
- lib/beyond_api/resources/shop.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#current ⇒ OpenStruct
A
GET
request is used to retrieve the details of a shop. -
#update(body) ⇒ OpenStruct
A
PATCH
request is used to change attributes of a shop.
Methods included from Utils
#file_content_type, #handle_all_request, #handle_error, #handle_response, #sanitize_key, #sanitize_response, #to_object_struct
Methods included from ShopLocations
#create_location, #delete_location, #location, #locations, #update_location
Methods included from ShopLegals
#legal_content, #legal_contents, #legal_details, #update_legal_content, #update_legal_details
Methods included from ShopImages
#create_image, #delete_image, #image, #images, #search_images_by_label, #upload_image
Methods included from ShopAttributes
#attribute, #attributes, #create_attribute, #delete_attribute, #update_attribute
Methods included from ShopAddress
Methods inherited from Base
Constructor Details
This class inherits a constructor from BeyondApi::Base
Instance Method Details
#current ⇒ OpenStruct
A GET
request is used to retrieve the details of a shop.
$ curl 'https://api-shop.beyondshop.cloud/api/shop' -i -X GET \
-H 'Accept: application/hal+json'
31 32 33 34 35 36 37 38 |
# File 'lib/beyond_api/resources/shop.rb', line 31 def current path = "/shop" response, status = BeyondApi::Request.get(@session, path) handle_response(response, status) end |
#update(body) ⇒ OpenStruct
A PATCH
request is used to change attributes of a shop.
$ curl 'https://api-shop.beyondshop.cloud/api/shop' -i -X PATCH \
-H 'Content-Type: application/json' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>' \
-d '{
"name" : "anotherName",
"primaryHostname" : "cornershop.amazingdiscounts.xyz",
"fallbackHostname" : "cornershop.beyondshop.cloud",
"tax" : {
"taxModel" : "GROSS",
"vatExempted" : false
},
"currencies" : [ "EUR", "USD", "GBP" ],
"defaultCurrency" : "USD",
"locales" : [ "en-GB", "de-DE" ],
"defaultLocale" : "en-GB",
"closedByMerchant" : false
}'
86 87 88 89 90 91 92 93 94 |
# File 'lib/beyond_api/resources/shop.rb', line 86 def update(body) path = "/shop" response, status = BeyondApi::Request.patch(@session, path, body) handle_response(response, status) end |