From 246ed247570331e6752b90faa75b4d3cdf09abc8 Mon Sep 17 00:00:00 2001 From: Rob Rua Date: Sat, 11 Jul 2015 01:18:24 -0400 Subject: [PATCH] line endings --- DISCLAIMER | 2 +- LICENSE | 40 ++-- README.md | 474 ++++++++++++++++++++++++------------------------ android-pom.xml | 114 ++++++------ pom.xml | 66 +++---- 5 files changed, 348 insertions(+), 348 deletions(-) diff --git a/DISCLAIMER b/DISCLAIMER index 5f8b23d3d..43fb04ff0 100644 --- a/DISCLAIMER +++ b/DISCLAIMER @@ -1 +1 @@ -Orianna isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc. +Orianna isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc. diff --git a/LICENSE b/LICENSE index 831adf969..93cabed61 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2015 Rob Rua - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +The MIT License (MIT) + +Copyright (c) 2015 Rob Rua + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 4d60ff35d..9f2718ffc 100644 --- a/README.md +++ b/README.md @@ -1,237 +1,237 @@ -# Orianna V2 - -A Java adaptation of the Riot Games LoL API (http://developer.riotgames.com/). - -Orianna is back, rebuilt from the ground up with some new features, Java 7 compatibility, and a whole lot more in store. -In addition to the standard RiotAPI we've added a BaseRiotAPI which can interact with the Riot API exactly according to specification. -We've also changed the core architecture to be more resilient to future API changes and ease maintenance. - -## Features (RiotAPI) - -- Usability-focused type system to make your life easy -- Automatically throttles requests to fit rate limits -- Ensures well-formed API requests -- Replaces foreign key ID values with the referenced object -- Option to lazy load referenced objects right when you need them or load them automatically upfront with minimal API calls -- Caches static data and summoner information to accelerate access and reduce API load -- Automatic databasing using [Hibernate](http://hibernate.org/). See [the project here.](https://github.com/robrua/orianna-hibernate) - -## Features (BaseRiotAPI) - -- Meets the Riot API specification exactly -- Automatically throttles requests to fit rate limits -- Ensures well-formed API requests -- Make only the requests you want to make, no foreign keys are auto-filled - -## Setup - -Just [download](https://github.com/robrua/Orianna/releases) the latest .jar and add it to your project's build path. - -To do this in eclipse, I recommend creating a lib/ directory in your project's root directory and putting the .jar there. Then just right click the .jar in eclipse and click Build Path -> Add to Build Path. - -You can also find the latest SNAPSHOT build [here](http://robrua.com/orianna). - -If you use Maven to manage your dependencies, Orianna is posted on Maven Central: - -Standard Java -```xml - - com.robrua - orianna - 2.3.0 - -``` - -Android -```xml - - com.robrua - orianna-android - 2.3.0 - -``` - -Or using Gradle: - -Standard Java -``` -repositories { - mavenCentral() -} - -dependencies { - compile 'com.robrua:orianna:2.3.0' -} -``` - -Android -``` -repositories { - mavenCentral() -} - -dependencies { - compile 'com.robrua:orianna-android:2.3.0' -} -``` - -## Dependencies - -Orianna relies on [Apache HttpClient](http://hc.apache.org/httpcomponents-client-ga/) v4.3.5 (Android v4.3.5.1) and [Google GSON](https://code.google.com/p/google-gson/) v2.3.1. Both are included in the JARs distributed here. - -## Usage - -Here's some examples of a few basic uses of the API. The full JavaDoc can be found at http://robrua.github.io/Orianna/. - -```java -import java.util.List; - -import com.robrua.orianna.api.core.RiotAPI; -import com.robrua.orianna.type.core.common.QueueType; -import com.robrua.orianna.type.core.common.Region; -import com.robrua.orianna.type.core.league.League; -import com.robrua.orianna.type.core.staticdata.Champion; -import com.robrua.orianna.type.core.summoner.Summoner; - -public class Example { - public static void main(String[] args) { - RiotAPI.setMirror(Region.NA); - RiotAPI.setRegion(Region.NA); - RiotAPI.setAPIKey("YOUR-API-KEY-HERE"); - - Summoner summoner = RiotAPI.getSummonerByName("FatalElement"); - System.out.println(summoner.getName() + " is a level " + summoner.getLevel() + " summoner on the NA server."); - - List champions = RiotAPI.getChampions(); - System.out.println("He enjoys playing LoL on all different champions, like " + champions.get((int)(champions.size() * Math.random())) + "."); - - League challenger = RiotAPI.getChallenger(QueueType.RANKED_SOLO_5x5); - Summoner bestNA = challenger.getEntries().get(0).getSummoner(); - System.out.println("He's much better at writing Java code than he is at LoL. He'll never be as good as " + bestNA + "."); - } -} -``` - -Make sure you set your rate limit! Orianna will limit you the the default development limit until you give it your production limit (if you have one). - -```java -// 10,000 calls per 10 seconds -RiotAPI.setRateLimit(10000, 10); -// 10,000 calls per 10 seconds AND 50,000 calls per minute -RiotAPI.setRateLimit(new RateLimit(10000, 10), new RateLimit(50000, 60)); -``` - -New in V2, you can set a load policy for filling in foreign key values. UPFRONT will load everything ASAP with a minimal number of calls. LAZY will load things as you ask for them, so you can save calls if you don't use some values, but it won't be able to take as much advantage of bulk loading. - -```java -// Upfront loading is the default strategy -RiotAPI.setLoadPolicy(LoadPolicy.UPFRONT); -``` - -For you Android devs out there there's also a new AsyncRiotAPI, which will perform all of your API calls on a different thread (since no networking is allowed on the main thread). - -```java -import java.util.List; - -import com.robrua.orianna.api.core.AsyncRiotAPI; -import com.robrua.orianna.type.api.Action; -import com.robrua.orianna.type.core.common.QueueType; -import com.robrua.orianna.type.core.common.Region; -import com.robrua.orianna.type.core.league.League; -import com.robrua.orianna.type.core.staticdata.Champion; -import com.robrua.orianna.type.core.summoner.Summoner; -import com.robrua.orianna.type.exception.APIException; - -public class Example { - public static void main(String[] args) { - AsyncRiotAPI.setMirror(Region.NA); - AsyncRiotAPI.setRegion(Region.NA); - AsyncRiotAPI.setAPIKey("YOUR-API-KEY-HERE"); - - AsyncRiotAPI.getSummonerByName(new Action() { - @Override - public void perform(Summoner summoner) { - System.out.println(summoner.getName() + " is a level " + summoner.getLevel() + " summoner on the NA server."); - } - - public void handle(APIException e) { - System.out.println("Couldn't get summoner FatalElement"); - } - }, "FatalElement"); - - AsyncRiotAPI.getChampions(new Action>() { - @Override - public void perform(List champions) { - System.out.println("He enjoys playing LoL on all different champions, like " + champions.get((int)(champions.size() * Math.random())) + "."); - } - - public void handle(APIException e) { - System.out.println("Couldn't get champion list."); - } - }); - - AsyncRiotAPI.getChallenger(new Action() { - @Override - public void perform(League challenger) { - Summoner bestNA = challenger.getEntries().get(0).getSummoner(); - System.out.println("He's much better at writing Java code than he is at LoL. He'll never be as good as " + bestNA + "."); - } - - public void handle(APIException e) { - System.out.println("Couldn't get solo queue challenger league."); - } - }, QueueType.RANKED_SOLO_5x5); - } -} -``` - -Or, if you don't want all the bells and whistles and you'd just like to access the Riot API as the specification says, you can use BaseRiotAPI (there's also an AsyncBaseRiotAPI). - -```java -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.robrua.orianna.api.dto.BaseRiotAPI; -import com.robrua.orianna.type.core.common.QueueType; -import com.robrua.orianna.type.core.common.Region; -import com.robrua.orianna.type.dto.league.League; -import com.robrua.orianna.type.dto.staticdata.Champion; -import com.robrua.orianna.type.dto.staticdata.ChampionList; -import com.robrua.orianna.type.dto.summoner.Summoner; - -public class Example { - public static void main(String[] args) { - BaseRiotAPI.setMirror(Region.NA); - BaseRiotAPI.setRegion(Region.NA); - BaseRiotAPI.setAPIKey("YOUR-API-KEY-HERE"); - - Map summoners = BaseRiotAPI.getSummonersByName("FatalElement"); - Summoner summoner = summoners.get("fatalelement"); - System.out.println(summoner.getName() + " is a level " + summoner.getSummonerLevel() + " summoner on the NA server."); - - ChampionList champs = BaseRiotAPI.getChampions(); - List champions = new ArrayList<>(champs.getData().values()); - System.out.println("He enjoys playing LoL on all different champions, like " + champions.get((int)(champions.size() * Math.random())).getName() + "."); - - League challenger = BaseRiotAPI.getChallenger(QueueType.RANKED_SOLO_5x5); - String aChallenger = challenger.getEntries().get(0).getPlayerOrTeamName(); - System.out.println("He's much better at writing Java code than he is at LoL. He'll never be as good as " + aChallenger + "."); - } -} -``` - -## JavaDoc -[Found Here](http://robrua.github.io/Orianna/) - -## Download -[Releases](https://github.com/robrua/Orianna/releases)/[Snapshot](http://robrua.com/orianna) - -## Questions/Contributions -Feel free to send pull requests or to contact me via github or email (robrua@alumni.cmu.edu). - -## Bugs -There's probably typos or some data missing somewhere in the project. Let me know about any of them you run into. I'm also looking for consistent maintainers to help me out as the Riot API evolves. - -## Disclaimer -Orianna isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc. +# Orianna V2 + +A Java adaptation of the Riot Games LoL API (http://developer.riotgames.com/). + +Orianna is back, rebuilt from the ground up with some new features, Java 7 compatibility, and a whole lot more in store. +In addition to the standard RiotAPI we've added a BaseRiotAPI which can interact with the Riot API exactly according to specification. +We've also changed the core architecture to be more resilient to future API changes and ease maintenance. + +## Features (RiotAPI) + +- Usability-focused type system to make your life easy +- Automatically throttles requests to fit rate limits +- Ensures well-formed API requests +- Replaces foreign key ID values with the referenced object +- Option to lazy load referenced objects right when you need them or load them automatically upfront with minimal API calls +- Caches static data and summoner information to accelerate access and reduce API load +- Automatic databasing using [Hibernate](http://hibernate.org/). See [the project here.](https://github.com/robrua/orianna-hibernate) + +## Features (BaseRiotAPI) + +- Meets the Riot API specification exactly +- Automatically throttles requests to fit rate limits +- Ensures well-formed API requests +- Make only the requests you want to make, no foreign keys are auto-filled + +## Setup + +Just [download](https://github.com/robrua/Orianna/releases) the latest .jar and add it to your project's build path. + +To do this in eclipse, I recommend creating a lib/ directory in your project's root directory and putting the .jar there. Then just right click the .jar in eclipse and click Build Path -> Add to Build Path. + +You can also find the latest SNAPSHOT build [here](http://robrua.com/orianna). + +If you use Maven to manage your dependencies, Orianna is posted on Maven Central: + +Standard Java +```xml + + com.robrua + orianna + 2.3.0 + +``` + +Android +```xml + + com.robrua + orianna-android + 2.3.0 + +``` + +Or using Gradle: + +Standard Java +``` +repositories { + mavenCentral() +} + +dependencies { + compile 'com.robrua:orianna:2.3.0' +} +``` + +Android +``` +repositories { + mavenCentral() +} + +dependencies { + compile 'com.robrua:orianna-android:2.3.0' +} +``` + +## Dependencies + +Orianna relies on [Apache HttpClient](http://hc.apache.org/httpcomponents-client-ga/) v4.3.5 (Android v4.3.5.1) and [Google GSON](https://code.google.com/p/google-gson/) v2.3.1. Both are included in the JARs distributed here. + +## Usage + +Here's some examples of a few basic uses of the API. The full JavaDoc can be found at http://robrua.github.io/Orianna/. + +```java +import java.util.List; + +import com.robrua.orianna.api.core.RiotAPI; +import com.robrua.orianna.type.core.common.QueueType; +import com.robrua.orianna.type.core.common.Region; +import com.robrua.orianna.type.core.league.League; +import com.robrua.orianna.type.core.staticdata.Champion; +import com.robrua.orianna.type.core.summoner.Summoner; + +public class Example { + public static void main(String[] args) { + RiotAPI.setMirror(Region.NA); + RiotAPI.setRegion(Region.NA); + RiotAPI.setAPIKey("YOUR-API-KEY-HERE"); + + Summoner summoner = RiotAPI.getSummonerByName("FatalElement"); + System.out.println(summoner.getName() + " is a level " + summoner.getLevel() + " summoner on the NA server."); + + List champions = RiotAPI.getChampions(); + System.out.println("He enjoys playing LoL on all different champions, like " + champions.get((int)(champions.size() * Math.random())) + "."); + + League challenger = RiotAPI.getChallenger(QueueType.RANKED_SOLO_5x5); + Summoner bestNA = challenger.getEntries().get(0).getSummoner(); + System.out.println("He's much better at writing Java code than he is at LoL. He'll never be as good as " + bestNA + "."); + } +} +``` + +Make sure you set your rate limit! Orianna will limit you the the default development limit until you give it your production limit (if you have one). + +```java +// 10,000 calls per 10 seconds +RiotAPI.setRateLimit(10000, 10); +// 10,000 calls per 10 seconds AND 50,000 calls per minute +RiotAPI.setRateLimit(new RateLimit(10000, 10), new RateLimit(50000, 60)); +``` + +New in V2, you can set a load policy for filling in foreign key values. UPFRONT will load everything ASAP with a minimal number of calls. LAZY will load things as you ask for them, so you can save calls if you don't use some values, but it won't be able to take as much advantage of bulk loading. + +```java +// Upfront loading is the default strategy +RiotAPI.setLoadPolicy(LoadPolicy.UPFRONT); +``` + +For you Android devs out there there's also a new AsyncRiotAPI, which will perform all of your API calls on a different thread (since no networking is allowed on the main thread). + +```java +import java.util.List; + +import com.robrua.orianna.api.core.AsyncRiotAPI; +import com.robrua.orianna.type.api.Action; +import com.robrua.orianna.type.core.common.QueueType; +import com.robrua.orianna.type.core.common.Region; +import com.robrua.orianna.type.core.league.League; +import com.robrua.orianna.type.core.staticdata.Champion; +import com.robrua.orianna.type.core.summoner.Summoner; +import com.robrua.orianna.type.exception.APIException; + +public class Example { + public static void main(String[] args) { + AsyncRiotAPI.setMirror(Region.NA); + AsyncRiotAPI.setRegion(Region.NA); + AsyncRiotAPI.setAPIKey("YOUR-API-KEY-HERE"); + + AsyncRiotAPI.getSummonerByName(new Action() { + @Override + public void perform(Summoner summoner) { + System.out.println(summoner.getName() + " is a level " + summoner.getLevel() + " summoner on the NA server."); + } + + public void handle(APIException e) { + System.out.println("Couldn't get summoner FatalElement"); + } + }, "FatalElement"); + + AsyncRiotAPI.getChampions(new Action>() { + @Override + public void perform(List champions) { + System.out.println("He enjoys playing LoL on all different champions, like " + champions.get((int)(champions.size() * Math.random())) + "."); + } + + public void handle(APIException e) { + System.out.println("Couldn't get champion list."); + } + }); + + AsyncRiotAPI.getChallenger(new Action() { + @Override + public void perform(League challenger) { + Summoner bestNA = challenger.getEntries().get(0).getSummoner(); + System.out.println("He's much better at writing Java code than he is at LoL. He'll never be as good as " + bestNA + "."); + } + + public void handle(APIException e) { + System.out.println("Couldn't get solo queue challenger league."); + } + }, QueueType.RANKED_SOLO_5x5); + } +} +``` + +Or, if you don't want all the bells and whistles and you'd just like to access the Riot API as the specification says, you can use BaseRiotAPI (there's also an AsyncBaseRiotAPI). + +```java +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.robrua.orianna.api.dto.BaseRiotAPI; +import com.robrua.orianna.type.core.common.QueueType; +import com.robrua.orianna.type.core.common.Region; +import com.robrua.orianna.type.dto.league.League; +import com.robrua.orianna.type.dto.staticdata.Champion; +import com.robrua.orianna.type.dto.staticdata.ChampionList; +import com.robrua.orianna.type.dto.summoner.Summoner; + +public class Example { + public static void main(String[] args) { + BaseRiotAPI.setMirror(Region.NA); + BaseRiotAPI.setRegion(Region.NA); + BaseRiotAPI.setAPIKey("YOUR-API-KEY-HERE"); + + Map summoners = BaseRiotAPI.getSummonersByName("FatalElement"); + Summoner summoner = summoners.get("fatalelement"); + System.out.println(summoner.getName() + " is a level " + summoner.getSummonerLevel() + " summoner on the NA server."); + + ChampionList champs = BaseRiotAPI.getChampions(); + List champions = new ArrayList<>(champs.getData().values()); + System.out.println("He enjoys playing LoL on all different champions, like " + champions.get((int)(champions.size() * Math.random())).getName() + "."); + + League challenger = BaseRiotAPI.getChallenger(QueueType.RANKED_SOLO_5x5); + String aChallenger = challenger.getEntries().get(0).getPlayerOrTeamName(); + System.out.println("He's much better at writing Java code than he is at LoL. He'll never be as good as " + aChallenger + "."); + } +} +``` + +## JavaDoc +[Found Here](http://robrua.github.io/Orianna/) + +## Download +[Releases](https://github.com/robrua/Orianna/releases)/[Snapshot](http://robrua.com/orianna) + +## Questions/Contributions +Feel free to send pull requests or to contact me via github or email (robrua@alumni.cmu.edu). + +## Bugs +There's probably typos or some data missing somewhere in the project. Let me know about any of them you run into. I'm also looking for consistent maintainers to help me out as the Riot API evolves. + +## Disclaimer +Orianna isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc. diff --git a/android-pom.xml b/android-pom.xml index dcebb82da..7cb6625b7 100644 --- a/android-pom.xml +++ b/android-pom.xml @@ -1,57 +1,57 @@ - - - 4.0.0 - orianna-android - 2.3.0 - jar - - - com.robrua - orianna-parent - 2.2.0 - parent-pom.xml - - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - 3.9.0-rc.2 - - - 19 - - true - true - - true - - - - - - org.apache.httpcomponents - httpclient-android - 4.3.5.1 - - - com.google.code.gson - gson - 2.3.1 - - - org.hibernate.javax.persistence - hibernate-jpa-2.1-api - 1.0.0.Final - - - com.google.android - android - 4.1.1.4 - provided - - - - - + + + 4.0.0 + orianna-android + 2.3.0 + jar + + + com.robrua + orianna-parent + 2.2.0 + parent-pom.xml + + + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + 3.9.0-rc.2 + + + 19 + + true + true + + true + + + + + + org.apache.httpcomponents + httpclient-android + 4.3.5.1 + + + com.google.code.gson + gson + 2.3.1 + + + org.hibernate.javax.persistence + hibernate-jpa-2.1-api + 1.0.0.Final + + + com.google.android + android + 4.1.1.4 + provided + + + + + diff --git a/pom.xml b/pom.xml index a2d46f10e..1fb213794 100644 --- a/pom.xml +++ b/pom.xml @@ -1,33 +1,33 @@ - - - 4.0.0 - orianna - 2.3.0 - jar - - - com.robrua - orianna-parent - 2.2.0 - parent-pom.xml - - - - - org.apache.httpcomponents - httpclient - 4.3.5 - - - com.google.code.gson - gson - 2.3.1 - - - org.hibernate.javax.persistence - hibernate-jpa-2.1-api - 1.0.0.Final - - - + + + 4.0.0 + orianna + 2.3.0 + jar + + + com.robrua + orianna-parent + 2.2.0 + parent-pom.xml + + + + + org.apache.httpcomponents + httpclient + 4.3.5 + + + com.google.code.gson + gson + 2.3.1 + + + org.hibernate.javax.persistence + hibernate-jpa-2.1-api + 1.0.0.Final + + +