Giter Site home page Giter Site logo

wowjavaapi's Introduction

About

This is a Java implementation of the Blizzard World of Warcraft API published at http://blizzard.github.com/api-wow-docs/.

This API follows the DAO pattern for access to the API. It uses simple Java Beans for entity modelling.

There are a number of Junit tests that test the parsing of the resulting JSON. In order to run the tests, you will need the http://mockito.org/ mock library and JUnit. These are not needed to use the API, just for testing. Anything in the test hierarchy is not needed to use the API. It includes pre-generated JSON responses from the API to speed up testing and to just test the JSON parsing and not require a network connection to run the tests. In other words, we just assume the network reading code works as expected (it's pretty simple, so it should always work and throw the correct exception if it doesn't).

This libaray current supports the Character, Guild and Realm areas of the Blizzard API.

Use at your own risk, this comes with no warranty.

Dependencies

  • Google Gson is required to use this API. The allows the parsing of JSON directly into Java objects. Plus I didn't want to reinvent the wheel.

  • Mockito for unit testing

  • JUnit for unit testing

The argument checking code was taken from Google Guava.

Usage

Characaters are retrieved via the CharacterDao class:

CharacterDao dao = new CharacterDao(); // Defaults to US Region
Character borvoh = dao.getCharacter("Duskwood", "Borvoh");

// To get reputation
Characater repUser = dao.getCharacter("Duskwood", "Borvoh", CharacterOptions.REPUTATION);

There are a number of getCharacter methods using varying defaults. See the JavaDoc for details.

Guilds are retrieved via the GuildDao class:

GuildDao dao = new GuildDao(); // Defaults to US
Guild guild = dao.getGuild("Duskwood", "Sheep the Moon");

Realm status is retrieved via the RealmDao class:

RealmDao dao = new RealmDao();
Realm duskwood = dao.getRealmStatus("Duskwood");

License

Copyright (C) 2011 Chris D. Halverson [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

wowjavaapi's People

Contributors

chalverson avatar

Stargazers

Jendorski avatar Animalejo avatar João Nuno Quintino avatar  avatar  avatar James Wendel avatar Brian Fehrle avatar

Watchers

 avatar  avatar  avatar

wowjavaapi's Issues

CharacterOptions.STATS doesn't work

I get the following error when calling CharacterDao.getCharacter(realmName,charName,CharacterOptions.STATS):

Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 10.650456 at line 1 column 438
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:241)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:231)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172)
at com.google.gson.Gson.fromJson(Gson.java:803)
at com.google.gson.Gson.fromJson(Gson.java:768)
at com.google.gson.Gson.fromJson(Gson.java:717)
at com.google.gson.Gson.fromJson(Gson.java:689)
at org.halverson.wowapi.dao.CharacterDao.getCharacter(CharacterDao.java:170)
at org.halverson.wowapi.dao.CharacterDao.getCharacter(CharacterDao.java:121)
at crow.jon.wow.Main.main(Main.java:13)
Caused by: java.lang.NumberFormatException: Expected an int but was 10.650456 at line 1 column 438
at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1181)
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:239)
... 12 more
Java Result: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.