Below is the json script i am using to create a Train Reservation Schema,
This is validated by Email Markup Tester by Google, but i am not able to see the Google now
card appearing on my phone?
Does any body has any example of TrainReservation Schema ?
Html :
<html>
<head>
</head>
<body>
<p>
This a test for a Go-To action in Gmail.
</p>
</body>
</html>
Script :
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "TrainReservation",
"reservationNumber" : "2065784893",
"modifyReservationUrl":"http://www.xyz.com/buytickets/myaccounthomepage.aspx",
"reservationFor": {
"#type": "TrainTrip",
"name" : ": LONDON TERMINALS to MANCHESTER STNS",
"description": "Departs 11:40 from LONDON TERMINALS Arrives 13:49 to MANCHESTER STNS",
"departureTime":"2013-12-17T14:20:03-08:00",
"arrivalTime":"2013-12-17T13:20:03-08:00",
"departureStation":"LONDON STNS",
"arrivalStation":"MANCHESTER STNS",
"trainCompany":"VIRGIN TRAINS"
},
"creator":{
"#type":"Person",
"name":"H Walia",
"email":"abc#example.com"
},
"price" : "28.05",
"modifyReservationUrl" : "http://help.xyz.com/app/answers/detail/a_id/3583",
"seat" : "ADVANCE SINGLE",
"bookingDate":"2013-12-17T09:21:03-08:00",
"bookingTime":"2013-12-17T09:20:03-08:00",
"numSeats" : "1",
"ticketDownloadUrl" : "http://www.xyz.com",
"ticketPrintUrl" : "http://www.xyz.com"
}
</script>
Train reservations are not yet supported in Google Now: https://developers.google.com/schemas/now/cards#supported_schemas
That reservation is for 2012. Try something with a departure time in the near future.
Related
I'm working on a very basic Grails application in order to dip my toes into web development.
Unfortunately, I'm stuck at trying to display a collection within my MongoDB database using the <f:table>-field tag.... Because the tag somehow seems to be incompatible with the unique constraint of my domain class? Is there anything I can do?
Here's the error message:
There was an unexpected error (type=Internal Server Error, status=500).
Error processing GroovyPageView: [views/teaser/index.gsp:17] Error executing tag <f:table>: Exception thrown applying constraint [unique] to class [class com.test.site.Teaser] for value [true]: Cannot invoke "grails.gorm.validation.Constraint.isValid()" because "c" is null
My BootStrap contains two object instances for testing purposes; they seem to be working fine, since they appear in my MongoDB. Just to be safe, here is how I stored them:
new Teaser(imageUrl: "", teaserUrl: "", name: "mainTeaser", text: "").save()
new Teaser(imageUrl: "", teaserUrl: "", name: "footerTeaser", text: "").save()
Here's my domain class:
package com.test.site
class Teaser {
String imageUrl
String teaserUrl
String name
String text
static mapWith = "mongo"
static constraints = {
name blank: false
name unique: true
}
Here's the current state of my index.gsp (linked to my controller):
<!doctype html>
<html>
<head>
<meta name="layout" content="main">
<asset:stylesheet href="styles.css"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Teaser Details</title>
</head>
<body id="body">
<header class="header">
</header>
<main class="main">
<div class="container">
<section>
<f:table collection="${teaserList}"/>
</section>
</div>
</main>
<footer class="footer">
</footer>
</body>
</html>
Finally, here's my controller:
package com.test.site
class TeaserController {
static scaffold = Teaser
def index() {
def teaserList = Teaser.list()
render view: "index", model: [teaserList : teaserList]
}
I'm grateful for any help :)
I try to use LodgingReservation Markup.
Documentation says that I can send email from own gmail mailbox to the same mailbox for testing.
I prepared simple test email:
<html>
<head>
</head>
<body>
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "LodgingReservation",
"reservationNumber": "abc456",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "John Smith"
},
"reservationFor": {
"#type": "LodgingBusiness",
"name": "Hilton San Francisco Union Square",
"address": {
"#type": "PostalAddress",
"streetAddress": "333 O'Farrell St",
"addressLocality": "San Francisco",
"addressRegion": "CA",
"postalCode": "94102",
"addressCountry": "US"
},
"telephone": "415-771-1400"
},
"checkinDate": "2027-04-11T16:00:00-08:00",
"checkoutDate": "2027-04-13T11:00:00-08:00"
}
</script>
test
</body>
</html>
Email markup Tester can parse it successfully. But when I send the email and check it in my Inbox, it doesn't show card with reservation's information.
Origin message:
Return-Path: <kaba.nitesoft#gmail.com>
Received: from MSI ([90.189.151.28])
by smtp.gmail.com with ESMTPSA id q16-20020a2e84d0000000b0025e71cdb753sm287017ljh.46.2022.08.09.23.49.57
for <kaba.nitesoft#gmail.com>
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Tue, 09 Aug 2022 23:49:58 -0700 (PDT)
Message-ID: <62f35516.2e0a0220.3adbf.15f2#mx.google.com>
Date: Tue, 09 Aug 2022 23:49:58 -0700 (PDT)
X-Google-Original-Date: 10 Aug 2022 13:49:58 +0700
MIME-Version: 1.0
From: kaba.nitesoft#gmail.com
To: kaba.nitesoft#gmail.com
Subject: Confirmation
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
PGh0bWw+DQoJCQkJCQkJCTxoZWFkPiANCgkJCQkJCQkJPC9oZWFkPg0KCQkJCQkJCQk8
Ym9keT4NCgkJCQkJCQkJCQk8c2NyaXB0IHR5cGU9ImFwcGxpY2F0aW9uL2xkK2pzb24i
Pg0KCQkJCQkJCQkJCXsNCgkJCQkJCQkJCQkgICJAY29udGV4dCI6ICJodHRwOi8vc2No
ZW1hLm9yZyIsDQoJCQkJCQkJCQkJICAiQHR5cGUiOiAiTG9kZ2luZ1Jlc2VydmF0aW9u
IiwNCgkJCQkJCQkJCQkgICJyZXNlcnZhdGlvbk51bWJlciI6ICJhYmM0NTYiLA0KCQkJ
CQkJCQkJCSAgInJlc2VydmF0aW9uU3RhdHVzIjogImh0dHA6Ly9zY2hlbWEub3JnL0Nv
bmZpcm1lZCIsDQoJCQkJCQkJCQkJICAidW5kZXJOYW1lIjogew0KCQkJCQkJCQkJCSAg
ICAiQHR5cGUiOiAiUGVyc29uIiwNCgkJCQkJCQkJCQkgICAgIm5hbWUiOiAiSm9obiBT
bWl0aCINCgkJCQkJCQkJCQkgIH0sDQoJCQkJCQkJCQkJICAicmVzZXJ2YXRpb25Gb3Ii
OiB7DQoJCQkJCQkJCQkJICAgICJAdHlwZSI6ICJMb2RnaW5nQnVzaW5lc3MiLA0KCQkJ
CQkJCQkJCSAgICAibmFtZSI6ICJIaWx0b24gU2FuIEZyYW5jaXNjbyBVbmlvbiBTcXVh
cmUiLA0KCQkJCQkJCQkJCSAgICAiYWRkcmVzcyI6IHsNCgkJCQkJCQkJCQkgICAgICAi
QHR5cGUiOiAiUG9zdGFsQWRkcmVzcyIsDQoJCQkJCQkJCQkJICAgICAgInN0cmVldEFk
ZHJlc3MiOiAiMzMzIE8nRmFycmVsbCBTdCIsDQoJCQkJCQkJCQkJICAgICAgImFkZHJl
c3NMb2NhbGl0eSI6ICJTYW4gRnJhbmNpc2NvIiwNCgkJCQkJCQkJCQkgICAgICAiYWRk
cmVzc1JlZ2lvbiI6ICJDQSIsDQoJCQkJCQkJCQkJICAgICAgInBvc3RhbENvZGUiOiAi
OTQxMDIiLA0KCQkJCQkJCQkJCSAgICAgICJhZGRyZXNzQ291bnRyeSI6ICJVUyINCgkJ
CQkJCQkJCQkgICAgfSwNCgkJCQkJCQkJCQkgICAgInRlbGVwaG9uZSI6ICI0MTUtNzcx
LTE0MDAiDQoJCQkJCQkJCQkJICB9LA0KCQkJCQkJCQkJCSAgImNoZWNraW5EYXRlIjog
IjIwMjctMDQtMTFUMTY6MDA6MDAtMDg6MDAiLA0KCQkJCQkJCQkJCSAgImNoZWNrb3V0
RGF0ZSI6ICIyMDI3LTA0LTEzVDExOjAwOjAwLTA4OjAwIg0KCQkJCQkJCQkJCX0NCgkJ
CQkJCQkJCQk8L3NjcmlwdD4NCgkJCQkJCQkJCXRlc3QNCgkJCQkJCQkJPC9ib2R5Pg0K
CQkJCQkJCTwvaHRtbD4=
What is wrong? How I can test markup correctly?
Another question:
If email contains attached receipt in pdf-format, Gmail shows reservation's card by parsed data from attached file. It's problem that Gmail parses it incorrectly (for instance it shows incorrect CheckoutDate). So, can I disable this behavior? Or how I can format pdf document that it will be parsed correctly?
I'm trying to use 11ty to generate pages for a movie review site. The structure of my _data folder is as follows.
_data
movies
2017
title1.json
title2.json
2018
2019
I'm hoping for output like this.
_site
movies
2017
title-1.html
title-2.html
2018
I would settle for output like this.
_site
movies
title-1.html
title-2.html
But I can't work out how to get anything close! Any ideas? Here's my nunjucks template. TitleWithYear is a property in each .json file.
---
pagination:
data: movies
size: 1
alias: movie
resolve: keys
permalink: "movies/{{ year??? }}/{{ movie.TitleWithYear | slug }}/index.html"
---
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body>
<h1>{{ movie.TitleWithYear }}</h1>
</body>
</html>
Edit: here's a repo showing the problem.
https://github.com/edmondbramhall/11ty-test1
Without the permalink line in, it does work although not with my desired folder structure in the output.
Edit: with Luke's help here's the pagination property I ended up with.
permalink: "movies/{{ movie.ReleaseYear }}/{{ movie.Id }}-{{ movie.Title | slug }}/index.html"
I also created a global filter for slugify to supply a couple of settings by creating a file .eleventy.js in the root folder of my project, with the following content.
const slugify = require('slugify');
module.exports = function(eleventyConfig) {
eleventyConfig.addFilter("slug", function(value) {
return slugify(value, { strict: true, lower: true });
});
};
You are using data: movies in your pagination, but the way that eleventy will try to deal with your given data folder structure is to make a list of objects per year folder, then each json file as a child JS object, with the filename as the key:
> console.log(data.movies)
[
{
'An-American-Tail_1986_4978': {
...
TitleWithYear: 'An American Tail (1986)',
Tagline: 'Meet Fievel. In his search to find his family, he discovered America.',
...
},
'Barbra-Streisand-One-Voice_1986_31683': {
...
TitleWithYear: 'Barbra Streisand: One Voice (1986)',
Tagline: 'Barbra sings in her backyard for charity!',
...
}
},
{
'Alien-Predators_1985_52318': {
...
TitleWithYear: 'Alien Predators (1985)',
...
}
}
]
To get the data into a format such that eleventy can paginate it properly, you need to munge it into a single large array of objects. The before callback functionality of eleventy is by far the easiest way of doing that (also possible via changing your data file structure, or by creating a custom collection in config).
This does require your frontmatter to be in a js format instead, but allows you to map for the actual movie objects and then flatten the resultant array.
Below is a full working example of the movie.njk file from your example repo.
---js
{
pagination:{
data: "movies",
before: (data) => data.map(year => Object.values(year)).flat(),
size: 1,
alias: "movie",
},
permalink: "movies/{{ movie.Id }}/",
}
---
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
</head>
<body>
<h1>{{ movie.TitleWithYear }}</h1>
<p> {{ movie.Tagline}}
</body>
</html>
Another workaround for structure:
_data
movies.js
movies
title1.json
title2.json
title3.json
movie.njk
use javascript data files
_data/movies.js:
const fs = require("fs");
const path = require("path");
const moviesFolder = path.resolve(__dirname, "../movies");
const movies = fs
.readdirSync(moviesFolder)
.filter(name => path.extname(name) === ".json")
.map(name => ({
key: path.parse(name).name,
...require(path.join(moviesFolder, name)),
}));
module.exports = movies;
movie.njk:
---
pagination:
data: "movies"
size: 1
alias: "movie"
permalink: "{{ movie.key }}/"
---
<h1>{{ movie.title }}</h1>
Im using rack-attack to block an ip.
# Block requests from 1.2.3.4
Rack::Attack.blocklist('block 1.2.3.4') do |req|
# Requests are blocked if the return value is truthy
'1.2.3.4' == req.ip
end
The IP gets successfully blocked. The person can view a white page with the word "forbidden" on the upper-left corner. Is there any way to change the string "forbidden" ?
EDIT :
Tried using this. All my other error pages are also configured similarly.
https://mattbrictson.com/dynamic-rails-error-pages
But it doesn't seen to work on the rack attack 403 forbidden page.
To customize the response of blocklisted and throttled requests, use an object that adheres to the Rack app interface.
Rack::Attack.blocklisted_response = lambda do |env|
# Using 503 because it may make the attacker think that he had successfully
# DOSed the site. Rack::Attack returns 403 for blocklists by default
[ 503, {}, ['Your custom string here']]
end
see the relevant documentation
Overwrite blocklisted_response.
#Tony Vincent is correct. I thought I would just elaborate a little further.
You just need to overwrite the default value for blocklisted_response.
You can see the default value here:
#blocklisted_response = lambda { |_env| [403, { 'Content-Type' => 'text/plain' }, ["Forbidden\n"]] }
So in your rack_attack.rb initializer, you can do the following:
Rack::Attack.blocklisted_response = lambda{ |_env| [ 403, { "Content-Type" => "text/plain" }, [ "You have been blocked from the system. If you think this has been done in error, please contact Support at support#system.com. Thank you." ] ] }
Overwrite blocklisted_response
You can display HTML pages also
So in your rack_attack.rb initializer, you can do the following:
Rack::Attack.blocklisted_response = lambda{ |_env| [ 403, { "Content-Type" => "text/html" }, [ "<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<meta name='viewport' content='width=device-width,initial-scale=1'>
</head>
<body class='rails-default-error-page'>
<!-- This file lives in public/404.html -->
<div class='dialog'>
<div>
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>
" ] ] }
I'm trying to implement One-Click Actions for Gmail using a 'Confirm Action'. The developer page specifies a 'requiresConfirmation' option [if true, additional confirmation is required before the handler executes]. I tried setting this to 'true', but didn't work.
How is this supposed to work? I'm using the following markup
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EmailMessage",
"description": "Verify your email address",
"action": {
"#type": "ConfirmAction",
"name": "Verify Email Address",
"handler": {
"#type": "HttpActionHandler",
"url": "https://mywebsite.com/verify?email=info#mywebsite.com",
"requiresConfirmation": true
}
}
}
</script>
The schema validates at Schema Validator. Any help would be appreciated. The above code works otherwise.
The requiresConfirmation flag is not supported yet. I'll make sure the documentation is updated to reflect the current status.