Skip to content
Pavel Dedik edited this page May 31, 2013 · 2 revisions

This page describes the basic architecture of the application.

Domain Model

The application registers two entities which are subclasses of the abstract class Document (see gplusfriends/models.py).

###class Document()

Abstract class that represents a document (e.g. XML, JSON).

method to_dict()
Creates a dictionary which represents an instance of the subclassed class.

method to_json()
Creates a JSON document which represents an instance of the subclassed class.

method to_xml()
Creates an XML document which represents an instance of the subclassed class.

method to_etree()
Creates an element tree which represents an instance of the subclassed class.

###class Person(**kwargs)

Representation of a person. See Google+ API reference.

  • id: Google+ unique ID of the person.
  • name: Name of the person.
  • url: The link to the profile of the person.
  • gender: The person's gender. Possible values are male, female or other.
  • type: Whether the person is a page or a person.
  • people: All the friends the person has in their circles.
  • activities: All the activities the person posted.

###class Activity(**kwargs)

Representation of an activity. See Google+ API reference.

  • id: Google+ unique ID of the activity.
  • title: Title of the activity.
  • url: The link to the activity.
  • date: The time at which this activity was initially published.
  • content: The content of the activity (HTML formated).
  • publisher: The person who performed the activity.

Views

Endpoints of the application (see gplusfriends/views.py).

###Endpoints

GET /
Homepage of the application.

GET /people/<pid:string>
Endpoint that displays persons's friends, acquantances, followed pages and activities (which are notes the users have posted to their stream).

GET /activities/<string:aid>
Endpoint that displays the specified activity.

POST /people
Redirects the user to a person corresponding the input value.

POST /activities
Redirects the user to an activity corresponding the input value.

GET /login
Login endpoint which authorizes the user through the Google+ API.

GET /logout
Logout endpoint which removes the logged user's access_token from the session.

GET /auth
URI where the Google API redirects the user after successful login.

API Resources

The application uses four Google+ API resources (see gplusfriends/resources.py).

Resource people/{id}
Requests user's data by their Google+ unique ID and creates an instance of the class Person.

Resource activities/{id}
Requests activity's data by its Google+ unique ID and creates an instance of the class Activity.

Resource people/{id}/people/visible
Requests information about given persons's friends and creates a list of instances of the class Person.

Resource people/{id}/activities/public
Requests information about given persons's public activities and creates a list of instances of the class Activity.

Templates

The templates of the application are created with the Jinja2 template engine (see gplusfriends/templates/*).

Template index.html
Represents the basic layout of the page. Other templates extends this template.

Template loggedout.html
If the user is not logged in with their Google+ account, this template representing the homepage of the application is displayed.

Template loggedin.html
The template provides basic tools of the application and is presented to the user when they are successfully logged in.

Template person.html
Displayes the downloaded data of a person from the google+ API and provides tools for converting and downloading the data as an XML document.

Template activity.html
Displayes the downloaded data of an activity from the google+ API and provides tools for converting and downloading the data as an XML document.

Template 404.html
This template is displayed when the user enters in the browser a URL which doesn't exist.

Template 401.html
This template is displayed when the user doesn't have sufficient right to view the requested data.

Clone this wiki locally