mfz-play-module-twitter

Play framework 2.x module to fetch, cache, and display tweets from Twitter

License

License

GroupId

GroupId

com.mfizz
ArtifactId

ArtifactId

mfz-play-module-twitter_2.10
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

mfz-play-module-twitter
Play framework 2.x module to fetch, cache, and display tweets from Twitter
Project URL

Project URL

http://mfizz.com/oss/play-module-twitter
Project Organization

Project Organization

Mfizz Inc
Source Code Management

Source Code Management

https://github.com/mfizz-inc/play-module-twitter

Download mfz-play-module-twitter_2.10

How to add to project

<!-- https://jarcasting.com/artifacts/com.mfizz/mfz-play-module-twitter_2.10/ -->
<dependency>
    <groupId>com.mfizz</groupId>
    <artifactId>mfz-play-module-twitter_2.10</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.mfizz/mfz-play-module-twitter_2.10/
implementation 'com.mfizz:mfz-play-module-twitter_2.10:1.0'
// https://jarcasting.com/artifacts/com.mfizz/mfz-play-module-twitter_2.10/
implementation ("com.mfizz:mfz-play-module-twitter_2.10:1.0")
'com.mfizz:mfz-play-module-twitter_2.10:jar:1.0'
<dependency org="com.mfizz" name="mfz-play-module-twitter_2.10" rev="1.0">
  <artifact name="mfz-play-module-twitter_2.10" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.mfizz', module='mfz-play-module-twitter_2.10', version='1.0')
)
libraryDependencies += "com.mfizz" % "mfz-play-module-twitter_2.10" % "1.0"
[com.mfizz/mfz-play-module-twitter_2.10 "1.0"]

Dependencies

compile (7)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.0
play » play_2.10 jar 2.1.1
org.twitter4j : twitter4j-core jar [3.0.3,)
com.twitter : twitter-text jar [1.6.1,)
play » play-java_2.10 jar 2.1.1
play » play-java-jdbc_2.10 jar 2.1.1
play » play-java-ebean_2.10 jar 2.1.1

test (1)

Group / Artifact Type Version
play » play-test_2.10 jar 2.1.1

Project Modules

There are no modules declared in this project.

Twitter for PlayFramework

Overview

Play Framework 2.x. to fetch, cache, and display tweets from Twitter. Resilient against Twitter API downtime by maintaining a cached copy of the last successful API call. Basic rendering of tweets into html for simple display -- or using the advanced object model to render your own.

Compatibility matrix

PlayFramework version Module version
2.3.x 2.2.0
2.2.x 2.1.0
2.1.x 2.0.1

Usage

This module is published to Maven Central. You will need to include the module in your dependencies list, in build.sbt or Build.scala file:

build.sbt

libraryDependencies ++= Seq(
  "com.fizzed" %% "fizzed-play-module-twitter" % "2.2.0"
)

Build.scala

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName         = "sample"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    javaCore,
    javaJdbc,
    javaEbean,
    "com.fizzed" %% "fizzed-play-module-twitter" % "2.2.0"
  )
  
  ...
}

Configuration

conf/play.plugins

Create this configuration file if it doesn't exist. Add this line to activate the plugin at runtime.

1000:com.fizzed.play.twitter.TwitterPlugin

conf/application.conf

twitter.access-token = "required: replace with twitter access token"
twitter.access-secret =  "required: replace with twitter access secret"
twitter.consumer-key = "required: replace with twitter consumer key"
twitter.consumer-secret = "required: replace with twitter consumer secret"
twitter.refresh-interval = 60m

From a Java-based controller

See fizzed-java-sample project for full example.

package controllers;

import com.fizzed.play.twitter.TwitterPlugin;

import play.*;
import play.mvc.*;

public class Application extends Controller {
  
    static public TwitterPlugin TWITTER_PLUGIN = Play.application().plugin(TwitterPlugin.class);
	
    public static Result index() {
        return ok(views.html.index.render());
    }
    
    public static TwitterPlugin twitter() {
    	return TWITTER_PLUGIN;
    }
  
}

From a Scala-based controller

See fizzed-scala-sample project for full example.

package controllers

import com.fizzed.play.twitter.TwitterPlugin

import play.api._
import play.api.mvc._

object Application extends Controller {

  val TWITTER_PLUGIN = Play.current.plugin[TwitterPlugin]

  def index = Action {
    Ok(views.html.index("Fizzed Twitter Module Sample"))
  }

}

Versions

Version
1.0