Package org.opensocial.models

Examples of org.opensocial.models.MediaItem


  public void create() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      MediaItem mediaItem = new MediaItem();
      mediaItem.setUrl("http://api.myspace.com/v1/users/63129100");

      Notification notification = new Notification();
      notification.setContent("Hi ${recipient}, here's a notification from " +
          "${canvasUrl}");
      notification.addRecipient("495184236");
View Full Code Here


    String description = "item description";
    String mimeType = "image/jpeg";
    String thumbnailUrl = "http://thumbnail_url";
    String type = "image";
    String url = "http://url";
    MediaItem item = new MediaItem();
    item.setId(itemId);
    item.setAlbumId(albumId);
    item.setCaption(caption);
    item.setDescription(description);
    item.setMimeType(mimeType);
    item.setThumbnailUrl(thumbnailUrl);
    item.setType(type);
    item.setUrl(url);

    request = MediaItemsService.createMediaItem(item);
    assertRequestValid(null, "mediaItems.create", "POST");
    assertRequestComponent("@me", Request.GUID);
    assertRequestComponent(albumId, Request.ALBUM_ID);
View Full Code Here

    String description = "item description";
    String mimeType = "image/jpeg";
    String thumbnailUrl = "http://thumbnail_url";
    String type = "image";
    String url = "http://url";
    MediaItem item = new MediaItem();
    item.setId(itemId);
    item.setAlbumId(albumId);
    item.setCaption(caption);
    item.setDescription(description);
    item.setMimeType(mimeType);
    item.setThumbnailUrl(thumbnailUrl);
    item.setType(type);
    item.setUrl(url);

    request = MediaItemsService.updateMediaItem(item);
    assertRequestValid(null, "mediaItems.update", "PUT");
    assertRequestComponent("@me", Request.GUID);
    assertRequestComponent(albumId, Request.ALBUM_ID);
View Full Code Here

    String description = "item description";
    String mimeType = "image/jpeg";
    String thumbnailUrl = "http://thumbnail_url";
    String type = "image";
    String url = "http://url";
    MediaItem item = new MediaItem();
    item.setId(itemId);
    item.setAlbumId(albumId);
    item.setCaption(caption);
    item.setDescription(description);
    item.setMimeType(mimeType);
    item.setThumbnailUrl(thumbnailUrl);
    item.setType(type);
    item.setUrl(url);
    File content = new File("");

    request = MediaItemsService.uploadImage(item, content);
    assertRequestValid(MediaItem.class, "mediaItems.create", "POST");
    assertRequestComponent("@me", Request.GUID);
View Full Code Here

    String description = "item description";
    String mimeType = "image/jpeg";
    String thumbnailUrl = "http://thumbnail_url";
    String type = "image";
    String url = "http://url";
    MediaItem item = new MediaItem();
    item.setId(itemId);
    item.setAlbumId(albumId);
    item.setCaption(caption);
    item.setDescription(description);
    item.setMimeType(mimeType);
    item.setThumbnailUrl(thumbnailUrl);
    item.setType(type);
    item.setUrl(url);
    File content = new File("");

    request = MediaItemsService.uploadVideo(item, content);
    assertRequestValid(MediaItem.class, "mediaItems.create", "POST");
    assertRequestComponent("@me", Request.GUID);
View Full Code Here

          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = MediaItemsService.getMediaItem(
          "myspace.com.mediaItem.image.646364", "myspace.com.album.81886");
      Response response = client.send(request);

      MediaItem mediaItem = response.getEntry();
      assertTrue(mediaItem != null);
      assertTrue(mediaItem.getId().equals(
          "myspace.com.mediaItem.image.646364"));
      assertTrue(mediaItem.getUrl() != null);
      assertTrue(mediaItem.getType() != null);
      //assertTrue(mediaItem.getTitle() != null);
      assertTrue(mediaItem.getThumbnailUrl() != null);
    } catch (Exception e) {
      fail("Exception occurred while processing request");
    }
  }
View Full Code Here

  public void createMediaItem() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      MediaItem mediaItem = new MediaItem();
      mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
      mediaItem.setAlbumId("myspace.com.album.81886");
      mediaItem.setType("IMAGE");
      mediaItem.setMimeType("image/gif");

      Request request = MediaItemsService.createMediaItem(mediaItem);
      Response response = client.send(request);

      assertTrue(response.getStatusLink() != null);
View Full Code Here

  public void createMediaItemWithoutAlbumId() throws RequestException,
      IOException {
    Client client = new Client(new MySpaceProvider(),
        new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

    MediaItem mediaItem = new MediaItem();
    mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
    mediaItem.setType("IMAGE");
    mediaItem.setMimeType("image/gif");

    Request request = MediaItemsService.createMediaItem(mediaItem);
  }
View Full Code Here

  public void updateMediaItem() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      MediaItem mediaItem = new MediaItem();
      mediaItem.setId("myspace.com.mediaItem.image.646364");
      mediaItem.setAlbumId("myspace.com.album.81886");
      mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
      mediaItem.setType("IMAGE");
      mediaItem.setMimeType("image/gif");

      Request request = MediaItemsService.updateMediaItem(mediaItem);
      Response response = client.send(request);

      assertTrue(response.getStatusLink() != null);
View Full Code Here

  @Test(expected=RequestException.class)
  public void updateMediaItemWithoutId() throws RequestException, IOException {
    Client client = new Client(new MySpaceProvider(),
        new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

    MediaItem mediaItem = new MediaItem();
    mediaItem.setAlbumId("myspace.com.album.81886");
    mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
    mediaItem.setType("IMAGE");
    mediaItem.setMimeType("image/gif");

    Request request = MediaItemsService.updateMediaItem(mediaItem);
  }
View Full Code Here

TOP

Related Classes of org.opensocial.models.MediaItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.