Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for schedule HTML generation #153

Closed
ceci opened this issue Sep 15, 2014 · 7 comments
Closed

API for schedule HTML generation #153

ceci opened this issue Sep 15, 2014 · 7 comments

Comments

@ceci
Copy link
Contributor

ceci commented Sep 15, 2014

I will need an API that, given the session id and locale, returns the following a json with session details.

Such as, when I request the URL: submissoes.agilebrazil.com/2014/api/session/1108?locale=pt

I get the following json:

"session": {
    "id": 1108,
    "title": "Igualdade de gênero na computação",
    "authors": [
        {
            "name": "Cecilia Fernandes",
            "email": "myGravatarEmail@gmail.com"
        }, {
            "name": "Mariana Bravo",
            "email": "herGravatarEmail@gmail.com"
        }
    ],
    "prerequisites": "Ter uma opinião sobre o tema",
    "tags": ["Aprendizagem", "Cultura", "Evolução", "Melhoria contínua", "Times"],
    "session_type": "Duelo",
    "audience_level": "Iniciante",
    "track": "Interesse Geral",
    "summary": "Um assunto muito discutido já há uns bons anos é o da notável razão homens vs. mulheres nos cargos de TI. As medidas que se pode tomar a respeito disso são várias e diversas empresas têm abordagens bem diferentes para tratar tal assunto. Será que estamos tratando esse assunto tão relevante de forma adequada? Venha discutir as abordagens para reduzir a diferença entre sexos na comunidade ágil com duas mulheres na computação."
}
@hugocorbucci
Copy link
Member

Two things I would mention on this:

  1. Providing the email in a publicly accessible URL might not be a good idea. Either we need to secure it somehow or we clean up the email from there. I could provide the gravatar URL instead.
  2. I'd add the extension to the url request so that it's something like '1108.json?locale=pt'. Might also not want to next api into 2014 since it doesn't really make sense to have an API per conference.

Also have to think about tags as they didn't have translations before 2014.

@ceci
Copy link
Contributor Author

ceci commented Sep 18, 2014

  1. and 2., agreed!

As for the past conferences... do we really need to think about them? Do you think people will actually use that old information? :-)

@hugocorbucci
Copy link
Member

Just want to make sure we specify the behavior since the API will be available for those too

@ceci
Copy link
Contributor Author

ceci commented Sep 18, 2014

It makes more sense to me not to include tags for the past conferences, then, since that field was quite misused back then.

@hugocorbucci
Copy link
Member

I'll think about it. Might be able to just provide it without translations.
Miss-used from an organizer's perspective but authors still filled them in.

And for the record, here is a sample code for an early version:

sessions=Session.for_conference(c).with_state(['accepted', 'pending_confirmation']).includes([:author, :second_author, :session_type])
data = sessions.map do |session|
  {
    id: session.id,
    title: session.title,
    authors: session.authors.compact.map(&:full_name),
    tags: session.keywords.map{|t| I18n.t(t)},
    session_type: I18n.t(session.session_type.title)
  }
end
{sessions: data}.to_json

@hugocorbucci hugocorbucci self-assigned this Sep 22, 2014
hugocorbucci pushed a commit that referenced this issue Sep 30, 2014
Was giving 500 when the session couldn't be found.
Returning 404 is much better.
@hugocorbucci
Copy link
Member

Ended up not needing to add the extension as it defaults to json.

Path is /api/sessions/:id. Format defaults to json and locale defaults to pt (app default locale).
JSON is UTF-8 escaped by default. Handled on the client side if needed.

@hugocorbucci
Copy link
Member

Deployed in production

@ceci ceci mentioned this issue Oct 13, 2014
hugocorbucci pushed a commit that referenced this issue Nov 5, 2014
It is important for attendees to know that certain sessions have a
limited number of attendees.
Adding audience limit so that the schedule can show such sessions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants