master
Stuart Boston 11 years ago
parent 5642d7c99e
commit 3e1b0f268b

@ -64,7 +64,7 @@ import com.omertron.themoviedbapi.model2.StatusCode;
import com.omertron.themoviedbapi.model.TBD_ExternalSource;
import com.omertron.themoviedbapi.model.TBD_FindResults;
import com.omertron.themoviedbapi.model.TBD_Network;
import com.omertron.themoviedbapi.model.TBD_PersonCredits;
import com.omertron.themoviedbapi.model2.person.CreditInfo;
import com.omertron.themoviedbapi.model2.authentication.TokenAuthorisation;
import com.omertron.themoviedbapi.model2.authentication.TokenSession;
import com.omertron.themoviedbapi.model.Translation;
@ -658,7 +658,7 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TBD_PersonCredits getCreditInfo(String creditId, String language) throws MovieDbException {
public CreditInfo getCreditInfo(String creditId, String language) throws MovieDbException {
return tmdbCredits.getCreditInfo(creditId, language);
}
//</editor-fold>

@ -20,7 +20,7 @@
package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.TBD_PersonCredits;
import com.omertron.themoviedbapi.model2.person.CreditInfo;
import com.omertron.themoviedbapi.tools.ApiUrl;
import com.omertron.themoviedbapi.tools.HttpTools;
import com.omertron.themoviedbapi.tools.MethodBase;
@ -66,7 +66,7 @@ public class TmdbCredits extends AbstractMethod {
* @return
* @throws MovieDbException
*/
public TBD_PersonCredits getCreditInfo(String creditId, String language) throws MovieDbException {
public CreditInfo getCreditInfo(String creditId, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, creditId);
parameters.add(Param.LANGUAGE, language);
@ -75,7 +75,7 @@ public class TmdbCredits extends AbstractMethod {
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, TBD_PersonCredits.class);
return MAPPER.readValue(webpage, CreditInfo.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credit info", url, ex);
}

@ -29,7 +29,7 @@ Collections (Done)
/collection/{id} Get the basic collection information for a specific collection id.
/collection/{id}/images Get all of the images for a particular collection by collection id.
Companies
Companies (Done)
/company/{id} This method is used to retrieve all of the basic information about a company
/company/{id}/movies Get the list of movies associated with a particular company.

@ -0,0 +1,104 @@
/*
* Copyright (c) 2004-2015 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model2.person;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model2.tv.TVCredit;
/**
* @author stuart.boston
*/
public class CreditInfo extends AbstractJsonMapping {
private static final long serialVersionUID = 1L;
@JsonProperty("id")
private String id;
@JsonProperty("credit_type")
private String creditType;
@JsonProperty("department")
private String department;
@JsonProperty("job")
private String job;
@JsonProperty("media_type")
private String mediaType;
@JsonProperty("person")
private PersonBasic person;
@JsonProperty("media")
private TVCredit media;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCreditType() {
return creditType;
}
public void setCreditType(String creditType) {
this.creditType = creditType;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public String getMediaType() {
return mediaType;
}
public void setMediaType(String mediaType) {
this.mediaType = mediaType;
}
public PersonBasic getPerson() {
return person;
}
public void setPerson(PersonBasic person) {
this.person = person;
}
public TVCredit getMedia() {
return media;
}
public void setMedia(TVCredit media) {
this.media = media;
}
}

@ -17,29 +17,15 @@
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
package com.omertron.themoviedbapi.model2.person;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.omertron.themoviedbapi.model.AbstractIdName;
/**
* @author stuart.boston
*/
@JsonRootName("???")
public class TBD_PersonCredits extends AbstractJsonMapping {
public class PersonBasic extends AbstractIdName {
private static final long serialVersionUID = 1L;
// Properties
@JsonProperty("id")
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

@ -0,0 +1,74 @@
/*
* Copyright (c) 2004-2015 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model2.tv;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.AbstractIdName;
import java.util.List;
/**
* TV Favorite information
*
* @author stuart.boston
*/
public class TVCredit extends AbstractIdName {
@JsonProperty("original_name")
private String originalName;
@JsonProperty("character")
private String character;
@JsonProperty("seasons")
private List<TVSeasonBasic> seasons;
@JsonProperty("episodes")
private List<TVEpisodeBasic> episodes;
public String getOriginalName() {
return originalName;
}
public void setOriginalName(String originalName) {
this.originalName = originalName;
}
public String getCharacter() {
return character;
}
public void setCharacter(String character) {
this.character = character;
}
public List<TVSeasonBasic> getSeasons() {
return seasons;
}
public void setSeasons(List<TVSeasonBasic> seasons) {
this.seasons = seasons;
}
public List<TVEpisodeBasic> getEpisodes() {
return episodes;
}
public void setEpisodes(List<TVEpisodeBasic> episodes) {
this.episodes = episodes;
}
}

@ -0,0 +1,93 @@
/*
* Copyright (c) 2004-2015 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model2.tv;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* TV Favorite information
*
* @author stuart.boston
*/
public class TVEpisodeBasic extends AbstractJsonMapping {
@JsonProperty("air_date")
private String airDate;
@JsonProperty("season_number")
private int seasonNumber;
@JsonProperty("episode_number")
private int episodeNumber;
@JsonProperty("name")
private String name;
@JsonProperty("overview")
private String overview;
@JsonProperty("still_path")
private String stillPath;
public String getAirDate() {
return airDate;
}
public void setAirDate(String airDate) {
this.airDate = airDate;
}
public int getSeasonNumber() {
return seasonNumber;
}
public void setSeasonNumber(int seasonNumber) {
this.seasonNumber = seasonNumber;
}
public int getEpisodeNumber() {
return episodeNumber;
}
public void setEpisodeNumber(int episodeNumber) {
this.episodeNumber = episodeNumber;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOverview() {
return overview;
}
public void setOverview(String overview) {
this.overview = overview;
}
public String getStillPath() {
return stillPath;
}
public void setStillPath(String stillPath) {
this.stillPath = stillPath;
}
}

@ -0,0 +1,62 @@
/*
* Copyright (c) 2004-2015 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model2.tv;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* TV Favorite information
*
* @author stuart.boston
*/
public class TVSeasonBasic extends AbstractJsonMapping {
@JsonProperty("air_date")
private String airDate;
@JsonProperty("poster_path")
private String posterPath;
@JsonProperty("season_number")
private int seasonNumber;
public String getAirDate() {
return airDate;
}
public void setAirDate(String airDate) {
this.airDate = airDate;
}
public String getPosterPath() {
return posterPath;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
}
public int getSeasonNumber() {
return seasonNumber;
}
public void setSeasonNumber(int seasonNumber) {
this.seasonNumber = seasonNumber;
}
}

@ -21,10 +21,11 @@ package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.AbstractTests;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.TBD_PersonCredits;
import com.omertron.themoviedbapi.model2.person.CreditInfo;
import org.junit.After;
import org.junit.AfterClass;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@ -33,7 +34,7 @@ import org.junit.Test;
*
* @author stuart.boston
*/
public class TmdbCreditsTest extends AbstractTests{
public class TmdbCreditsTest extends AbstractTests {
private static TmdbCredits instance;
@ -43,7 +44,7 @@ public class TmdbCreditsTest extends AbstractTests{
@BeforeClass
public static void setUpClass() throws MovieDbException {
doConfiguration();
instance = new TmdbCredits(getApiKey(),getHttpTools());
instance = new TmdbCredits(getApiKey(), getHttpTools());
}
@AfterClass
@ -66,13 +67,12 @@ public class TmdbCreditsTest extends AbstractTests{
@Test
public void testGetCreditInfo() throws MovieDbException {
LOG.info("getCreditInfo");
String creditId = "525346f619c29579400d4145";
String language = "";
TBD_PersonCredits result = instance.getCreditInfo(creditId, language);
// assertEquals("Wrong name", "Sean Bean", result.getPerson().getName());
// assertEquals("Wrong job", "Actor", result.getJob());
// assertFalse("No seasons", result.getMedia().getSeasons().isEmpty());
fail("The test case is a prototype.");
String creditId = "53392a9c9251417da10041c8";
CreditInfo result = instance.getCreditInfo(creditId, LANGUAGE_DEFAULT);
assertEquals("Wrong name", "Josh McDermitt", result.getPerson().getName());
assertEquals("Wrong job", "Actor", result.getJob());
assertFalse("No seasons", result.getMedia().getSeasons().isEmpty());
assertFalse("No episodes", result.getMedia().getEpisodes().isEmpty());
}
}

Loading…
Cancel
Save