Sending the data-api-key value for Snipcart w/vue meta in gridsome - gridsome

I am doing an eCommerce site w/gridsome & snipcart. The problem is when I test snipcart's checkout it fails. The snipcart documentation says to add a line
<div id="snipcart" data-api-key="myapikey" hidden></div>
which I added to default.vue file in my layouts folder. But when I inspect element after build I see in DOM
<div id="snipcart" class="snipcart"></div>
The data-api-key attribute is not rendered. Utilizing vue-meta to inject api-key-data into markup in main.js per snipcart's [example][1] has same result:
head.script.push({
type: 'text/javascript',
src: 'https://cdn.snipcart.com/scripts/v3.0.4/snipcart.js',
body: true,
// snipcart's attributes
id: 'snipcart',
'data-api-key': 'apiKey',
});
The snipcart log's show this:
2020-01-08 10:52:51
INF>["req6fd695fe", "acc69393_test"] Impossible validate items for order 'fd0f6d92-b422-4b2c-8a50-a955b4eeceaa'. Please make sure the URL is valid, we suggest you take a look at our Security documentation http://docs.snipcart.com/getting-started/security) for more information.
Any help in getting snipcart to work w/gridsome much appreciated.
Update: - Followed instructions and have markup & dashboard setup as follows with a deploy to netlify # https://ecommerce-gridsome.netlify.com
<button
class="snipcart-add-item"
:data-item-id="product.id"
:data-item-name="product.title"
:data-item-description="excerpt"
:data-item-image="image.url"
:data-item-price="product.fields.Unit_cost"
:data-item-url="'https://ecommerce-gridsome.netlify.com' + $props.product.path"
>
Still get error in log:
2020-01-10 13:56:57
INF>["reqec389060", "acc69393_test"] Found 1 snipcart-add-item elements with ids [reckl3dcep4sbpWRi]
2020-01-10 13:56:57
INF>["reqec389060", "acc69393_test"] Validating item with id 'reckl3dcep4sbpWRi' located at https://ecommerce-gridsome.netlify.com/products/nebula-chair/' on domain 'ecommerce-gridsome.netlify.com'.
2020-01-10 13:56:57
INF>["reqec389060", "acc69393_test"] Found 1 snipcart-add-item elements with ids [recfEnH5eESHpWzLT]
2020-01-10 13:56:57
INF>["reqec389060", "acc69393_test"] Validating item with id 'recfEnH5eESHpWzLT' located at https://ecommerce-gridsome.netlify.com/products/compel-bookcase/' on domain 'ecommerce-gridsome.netlify.com'.
2020-01-10 13:56:52
INF>["req4a317e07", "acc69393_test"] Found 1 snipcart-add-item elements with ids [reckl3dcep4sbpWRi]
2020-01-10 13:56:52
INF>["req4a317e07", "acc69393_test"] Validating item with id 'reckl3dcep4sbpWRi' located at https://ecommerce-gridsome.netlify.com/products/nebula-chair/' on domain 'ecommerce-gridsome.netlify.com'.
2020-01-10 13:56:52
INF>["req4a317e07", "acc69393_test"] Found 1 snipcart-add-item elements with ids [recfEnH5eESHpWzLT]
2020-01-10 13:56:52
INF>["req4a317e07", "acc69393_test"] Validating item with id 'recfEnH5eESHpWzLT' located at https://ecommerce-gridsome.netlify.com/products/compel-bookcase/' on domain 'ecommerce-gridsome.netlify.com'.

If the cart opens, it means your API Key is correct.
Snipcart fully replaces the div, that's why you don't see your API Key anymore once the cart loads.
The log message indicates a crawling error. You'll have to make sure that your domain is configured in the dashboard and the product definition are available in the source of the page when it load. Snipcart's crawler doesn't execute Javascript, but Gridsome provide pre-rendered pages, so that's ok.

Related

ResolveFully option does not resolve all schemas in some paths

Swagger-parser version: 2.1.1
Example swagger spec:
The test case is quite large, so I put it in a github gist. Don't be surprised by the names of the paths and schemes - I masked the critical data.
Description:
When using the ResolveFully option, I get requests with unresolved links. For example, take the request POST /v1/BusinePEH0JF. In swagger-ui it renders correctly - in the request body in the manager field, the Emplo4XN6X schema is resolved:
enter image description here
But swagger-parser gives this result:
enter image description here
Here the link is not resolved. This is most likely due to the fact that the parent schema BusinesYD77B4X in this request is stored as such in resolvedModels due to the fact that it is also used in other requests, such as POST /v1/ApprovalSetU0C9RY71SHD/manager-to-employees. Here, the manager field is empty, because this scheme has already been used above in the approver field.
enter image description here
Reproduction of the error:
val parseOptions = new ParseOptions()
parseOptions.setResolve(true)
parseOptions.setResolveFully(true)
val openAPI = new OpenAPIV3Parser().read(swaggerSpec, null, parseOptions)
Expected result:
Like on the first screen in swagger-ui
Thanks!

Daloradius attribute issue: sql: Failed to create the pair: Unknown name

I followed steps in the link below to build a freeradius with daloradius on my CentOS 8 VM:
https://computingforgeeks.com/install-freeradius-and-daloradius-on-centos-rhel-8/
On daloradius, I created a new vendor and a new attrinute as below:
New Vendor and Atribute
Then I also created a user as below:
User1
User2
However, if I tried to access the radius server by the command below:
"radtest tester1 1111 192.168.123.87 0 secret1234",
I would get "Access-Reject".
From the radius.log, I could see error below:
"Wed Mar 2 03:27:39 2022 : Auth: (2) Login incorrect (sql: Failed to create the pair: Unknown name "Caswell-CW_group"): [tester1] (from client my_lan port 0)"
I have tried to check from my radius server via MariaDB and I could see below:
DB
So, I can not understand why I would get access-rejected and why sql would said Unknown name.
If I delete the check attribute in the user account "tester1", I could get access "Access-accept".
Do I miss anything in my settings on radius server?
I have founded the answer for my issue.
If I want to add a new vendor and attributes, I will need to add a new file under the path: /usr/share/freeradius/.For example, if I want to add a new vendor like "fortesting" and an new attribute "testing attribute".
I will need to add a new file called "dictionary.fortesting". And then I will need to modify the file "/usr/share/freeradius/dictionary" to include the file "dictionary.fortesting". After doing steps above, restating freeradius service. And then log in the WEB UI of daloradius, creating the same vendor and attributes.At last, I will be able to use the new vendor and attributes in my freeradius users.I will get " Access-Accept" while using the command "radtest".

Gerrit Code Review - Retrieve file content from Change Edit

Has anyone successfully constructed the correct url to retrieve the file content from this endpoint?
All my attempts have resulted in a status 404.
The documentation is confusing in this link
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-file
Below is the example it provides
GET /changes/{change-id}/edit/path%2fto%2ffile
this is data from gerrit.
{
"branch": "BR16516",
"change_id": "Ieb84eb99147fc39d3e117fe61eef8389d2f64611",
"change_number": "52490",
"change_revision": "2",
"file_name": "sql/BR16516-update-order-15102.sql",
"lines_inserted": 77,
"size_delta": 2041,
"status": "A"
}
I can't seem to provide a value for {change-id} and {'path%2fto%2ffile'} that gerrit recognises
The value I provided (see shown above) is the same value retrieved from /changes endpoint documented here
- https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
This is the code example provided:
Retrieves content of a file from a change edit.
Request
GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
In this example, the filename is 'foo' however the {change-id} introduces myProject~master~ and I tried substituting this for the relevant values for my project but with no luck.
If there are other endpoints that will give me plain text from the file in the branch, that will be good too.
I managed to get the file content from this end point
GET /changes/{change-id}/revisions/{revision-id}/files/{file-id}/content
change_id is the id from the change record
revision-id is the revision id from the change record
the change record is from the query changes end point
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes

Is there still "no API to manage consumer googlegroups.com groups programatically"?

In an answer to this 2014 post
Unable to retrieve members of a google group, getting Invalid Input
you read: "There is no API to manage consumer googlegroups.com groups programatically".
Is this still the situation in 2018?
I tried to follow the suggestion in answer 3 of the post How to get the list of members in a Google group in Google app script (Admin SDK)? but I get the following error message:
ReferenceError: "AdminDirectory" is not defined. (line 9, file "Code")
where line 9 (and following) is (are):
page = AdminDirectory.Members.list(groupKey,
{
domainName: 'googlegroups.#com',
maxResults: 500,
pageToken: pageToken,
});
Searching to understand the error I found the reference page for Members: list. Using the "Try this API" form in that page I get the error reported in the first post I mentioned.
If it is NOT true that "There is no API to manage consumer googlegroups.com groups programatically", is there a guide to copy the list of the members of a group I own in a google-sheet sheet? (I mean to copy via a function, non by hand exporting and reimporting the CSV)
Many thanks, Roberto Scotti
It's 2021 and I still can't find any evidence there's an API for #googlegroups.com groups, sadly.

How do I fetch orgusers beyond the 1st 100 using the Google Apps OrgUser provisioning API feed

I am using Zend's gdata library for the Google Apps provisioning API. Since Zend doesn't yet support fetching org users (no retrieve function provided by the library for this feed), I am making a custom gdata query to the url (as suggested in the documentation developers.google.com/google-apps/provisioning/#retrieving_organization_users_experimental):
apps-apis.google.com/a/feeds/orguser/2.0/'.$customerId.'?get=all
This works well for <= 100 users.
Now, I have created a domain with 125 users across 5 OUs. When I fetch the above URI, I get the 1st 100 users (as documented and expected). However, I could not find the pagination link mentioned here: developers.google.com/google-apps/provisioning/reference#Results_Pagination
Here's the start of my orguser feed:
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'><id>https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx</id><updated>2013-01-06T08:17:43.520Z</updated><**link rel='next' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn.**'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxx'/>
I tried the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn. link but it gives me the exact same 100 users that the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all link gives. This is the only occurrence of the word "next" in my feed and so there is not other URI I can try to fetch the next 25 users.
So I have only been able to get 100 users from this API call. How do I go about fetching the next 25 users? Examples/code would be really appreciated. Or what am I doing wrong?
Please help - this is blocking an urgent delivery.
Thanks!,
Vinay.
Your 2nd request should look like:
https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxx?startKey=RASS03jtnz0s2orxmbn&get=all
startKey should be set to the value of the next parameter and get should continue to be all for each page request.
Also, make sure the URL is decoded, if & is encoded as & in the request, then Google's servers will see all of all&startKey=RASS03jtnz0s2orxmbn as the value of get and it won't see a startKey parameter at all.

Resources