├── .gitignore ├── README.md ├── config └── config.exs ├── doc ├── .build ├── 404.html ├── FFNerd.AuctionValue.html ├── FFNerd.ByeWeek.html ├── FFNerd.Client.html ├── FFNerd.DefenseRanking.html ├── FFNerd.DepthChart.Player.html ├── FFNerd.DepthChart.html ├── FFNerd.DraftProjection.html ├── FFNerd.DraftRanking.html ├── FFNerd.ExpertPick.Game.html ├── FFNerd.ExpertPick.html ├── FFNerd.Game.html ├── FFNerd.Inactive.html ├── FFNerd.Injury.html ├── FFNerd.Player.Stats.html ├── FFNerd.Player.Video.html ├── FFNerd.Player.html ├── FFNerd.Schedule.html ├── FFNerd.Team.html ├── FFNerd.URL.html ├── FFNerd.Weather.html ├── FFNerd.WeeklyIDPRanking.html ├── FFNerd.WeeklyProjection.html ├── FFNerd.WeeklyRanking.html ├── FFNerd.html ├── api-reference.html ├── dist │ ├── app-5b9e160cec.css │ ├── app-da04b39d0c.js │ └── sidebar_items-6b1fe30cb7.js ├── fonts │ ├── icomoon.eot │ ├── icomoon.svg │ ├── icomoon.ttf │ └── icomoon.woff ├── index.html └── search.html ├── lib ├── ffnerd.ex └── ffnerd │ ├── auction_value.ex │ ├── bye-week.ex │ ├── client.ex │ ├── defense_ranking.ex │ ├── depth_chart.ex │ ├── depth_chart │ └── player.ex │ ├── draft_projection.ex │ ├── draft_ranking.ex │ ├── expert_pick.ex │ ├── expert_pick │ └── game.ex │ ├── game.ex │ ├── inactive.ex │ ├── injury.ex │ ├── player.ex │ ├── player │ ├── stats.ex │ └── video.ex │ ├── schedule.ex │ ├── team.ex │ ├── url.ex │ ├── weather.ex │ ├── weekly_idp_ranking.ex │ ├── weekly_projection.ex │ └── weekly_ranking.ex ├── mix.exs ├── mix.lock └── test ├── ffnerd ├── auction_value_test.exs ├── bye_week_test.exs ├── client_test.exs ├── defense_ranking_test.exs ├── depth_chart_test.exs ├── draft_projection_test.exs ├── draft_ranking_test.exs ├── expert_pick │ └── game_test.exs ├── expert_pick_test.exs ├── game_test.exs ├── inactive_test.exs ├── injury_test.exs ├── player │ ├── stats_test.exs │ └── video_test.exs ├── player_test.exs ├── schedule_test.exs ├── team_test.exs ├── weather_test.exs ├── weekly_idp_ranking_test.exs ├── weekly_projection_test.exs └── weekly_ranking_test.exs ├── ffnerd_test.exs └── test_helper.exs /.gitignore: -------------------------------------------------------------------------------- 1 | /_build 2 | /cover 3 | /deps 4 | erl_crash.dump 5 | *.ez 6 | -------------------------------------------------------------------------------- /config/config.exs: -------------------------------------------------------------------------------- 1 | # This file is responsible for configuring your application 2 | # and its dependencies with the aid of the Mix.Config module. 3 | use Mix.Config 4 | 5 | # This configuration is loaded before any dependency and is restricted 6 | # to this project. If another project depends on this project, this 7 | # file won't be loaded nor affect the parent project. For this reason, 8 | # if you want to provide default values for your application for 9 | # 3rd-party users, it should be done in your "mix.exs" file. 10 | 11 | # You can configure for your application as: 12 | # 13 | # config :ffnerd, key: :value 14 | # 15 | # And access this configuration in your application as: 16 | # 17 | # Application.get_env(:ffnerd, :key) 18 | # 19 | # Or configure a 3rd-party app: 20 | # 21 | # config :logger, level: :info 22 | # 23 | 24 | # It is also possible to import configuration files, relative to this 25 | # directory. For example, you can emulate configuration per environment 26 | # by uncommenting the line below and defining dev.exs, test.exs and such. 27 | # Configuration from the imported file will override the ones defined 28 | # here (which is why it is important to import them last). 29 | # 30 | # import_config "#{Mix.env}.exs" 31 | -------------------------------------------------------------------------------- /doc/.build: -------------------------------------------------------------------------------- 1 | dist/app-5b9e160cec.css 2 | dist/app-da04b39d0c.js 3 | fonts/icomoon.eot 4 | fonts/icomoon.svg 5 | fonts/icomoon.ttf 6 | fonts/icomoon.woff 7 | dist/sidebar_items-6b1fe30cb7.js 8 | api-reference.html 9 | search.html 10 | 404.html 11 | FFNerd.html 12 | FFNerd.AuctionValue.html 13 | FFNerd.ByeWeek.html 14 | FFNerd.Client.html 15 | FFNerd.DefenseRanking.html 16 | FFNerd.DepthChart.html 17 | FFNerd.DepthChart.Player.html 18 | FFNerd.DraftProjection.html 19 | FFNerd.DraftRanking.html 20 | FFNerd.ExpertPick.html 21 | FFNerd.ExpertPick.Game.html 22 | FFNerd.Game.html 23 | FFNerd.Inactive.html 24 | FFNerd.Injury.html 25 | FFNerd.Player.html 26 | FFNerd.Player.Stats.html 27 | FFNerd.Player.Video.html 28 | FFNerd.Schedule.html 29 | FFNerd.Team.html 30 | FFNerd.URL.html 31 | FFNerd.Weather.html 32 | FFNerd.WeeklyIDPRanking.html 33 | FFNerd.WeeklyProjection.html 34 | FFNerd.WeeklyRanking.html 35 | index.html 36 | -------------------------------------------------------------------------------- /doc/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 404 – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

Page not found

67 | 68 |

Sorry, but the page you were trying to get to, does not exist. You 69 | may want to try searching this site using the sidebar or using our 70 | API Reference page to find what 71 | you were looking for.

72 | 73 | 86 |
87 |
88 |
89 |
90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /doc/FFNerd.ByeWeek.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.ByeWeek – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.ByeWeek 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Bye Week resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#byes

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 |
98 | find(team, client) 99 |
100 | 101 |

Return a single bye week record by team code

102 |
103 | 104 |
105 |
106 |
107 | list(client) 108 |
109 | 110 |

Return a list of all bye week records

111 |
112 | 113 |
114 |
115 |
116 | list(id, client) 117 |
118 | 119 |

Return a list of bye week records by week number

120 |
121 | 122 |
123 |
124 | 127 | 128 |
129 | 130 |
131 | 132 | 133 | 134 | 135 |
136 | 137 | 138 | 139 | 140 | 141 |
142 |

143 | 144 | 145 | Link to this section 146 | 147 | Functions 148 |

149 |
150 | 151 | 152 |
153 | 154 | 155 | Link to this function 156 | 157 | find(team, client) 158 | 159 | 160 | 161 |
162 |
163 |

Return a single bye week record by team code.

164 |

165 | 166 | Examples 167 |

168 | 169 |

FFNerd.ByeWeek.find “SEA”, client

170 | 171 |
172 |
173 |
174 | 175 | 176 |
177 | 178 | 179 | Link to this function 180 | 181 | list(client) 182 | 183 | 184 | 185 |
186 |
187 |

Return a list of all bye week records.

188 |

189 | 190 | Examples 191 |

192 | 193 |

FFNerd.ByeWeek.list 4, client

194 | 195 |
196 |
197 |
198 | 199 | 200 |
201 | 202 | 203 | Link to this function 204 | 205 | list(id, client) 206 | 207 | 208 | 209 |
210 |
211 |

Return a list of bye week records by week number.

212 |

213 | 214 | Examples 215 |

216 | 217 |

FFNerd.ByeWeek.list 4, client

218 | 219 |
220 |
221 |
222 | 223 | 224 | 225 | 226 |
227 | 228 | 229 | Link to this function 230 | 231 | new(map_or_kwlist, opts \\ []) 232 | 233 | 234 | 235 |
236 | 237 |
new(ExConstructor.map_or_kwlist, Keyword.t) :: %FFNerd.ByeWeek{bye_week: term, display_name: term, team: term}
238 | 239 |
240 | 241 |
242 |
243 | 244 |
245 |
246 | 247 |
248 | 249 | 250 | 251 | 264 |
265 |
266 |
267 |
268 | 269 | 270 | 271 | 272 | 273 | -------------------------------------------------------------------------------- /doc/FFNerd.Client.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.Client – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.Client 69 | 70 |

71 | 72 | 73 | 74 | 75 |
76 |

77 | 78 | 79 | Link to this section 80 | 81 | Summary 82 |

83 | 84 | 85 | 86 |
87 |

88 | Functions 89 |

90 |
91 |
92 | new(auth) 93 |
94 | 95 |

Create new client with default endpoint

96 |
97 | 98 |
99 |
100 |
101 | new(auth, endpoint) 102 |
103 | 104 |

Create new client with custom endpoint

105 |
106 | 107 |
108 | 109 |
110 | 111 | 112 | 113 | 114 |
115 | 116 | 117 | 118 | 119 | 120 |
121 |

122 | 123 | 124 | Link to this section 125 | 126 | Functions 127 |

128 |
129 | 130 | 131 |
132 | 133 | 134 | Link to this function 135 | 136 | new(auth) 137 | 138 | 139 | 140 |
141 |
142 |

Create new client with default endpoint.

143 |

144 | 145 | Examples 146 |

147 | 148 |

FFNerd.Client.new “API-KEY-ABC-XYZ”

149 | 150 |
151 |
152 |
153 | 154 | 155 |
156 | 157 | 158 | Link to this function 159 | 160 | new(auth, endpoint) 161 | 162 | 163 | 164 |
165 |
166 |

Create new client with custom endpoint.

167 |

168 | 169 | Examples 170 |

171 | 172 |

FFNerd.Client.new “API-KEY”, “http://www.example.com”

173 | 174 |
175 |
176 | 177 |
178 | 179 | 180 | 181 | 194 |
195 |
196 |
197 |
198 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /doc/FFNerd.DefenseRanking.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.DefenseRanking – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.DefenseRanking 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Defense Ranking resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#defense-rankings

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 |
98 | find(team, client) 99 |
100 | 101 |

Return a defense ranking record by team code

102 |
103 | 104 |
105 |
106 |
107 | list(client) 108 |
109 | 110 |

Return a list of defense ranking records

111 |
112 | 113 |
114 |
115 |
116 | new(map) 117 |
118 | 119 |

Convert raw api data to Player.DefenseRanking struct

120 |
121 | 122 |
123 | 124 |
125 | 126 | 127 | 128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 |
136 |

137 | 138 | 139 | Link to this section 140 | 141 | Functions 142 |

143 |
144 | 145 | 146 |
147 | 148 | 149 | Link to this function 150 | 151 | find(team, client) 152 | 153 | 154 | 155 |
156 |
157 |

Return a defense ranking record by team code.

158 |

159 | 160 | Examples 161 |

162 | 163 |

FFNerd.DefenseRanking.find “SEA”, client

164 | 165 |
166 |
167 |
168 | 169 | 170 |
171 | 172 | 173 | Link to this function 174 | 175 | list(client) 176 | 177 | 178 | 179 |
180 |
181 |

Return a list of defense ranking records.

182 |

183 | 184 | Examples 185 |

186 | 187 |

FFNerd.DefenseRanking.list client

188 | 189 |
190 |
191 |
192 | 193 | 194 |
195 | 196 | 197 | Link to this function 198 | 199 | new(map) 200 | 201 | 202 | 203 |
204 |
205 |

Convert raw api data to Player.DefenseRanking struct.

206 | 207 |
208 |
209 | 210 |
211 | 212 | 213 | 214 | 227 |
228 |
229 |
230 |
231 | 232 | 233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /doc/FFNerd.DepthChart.Player.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.DepthChart.Player – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.DepthChart.Player 69 | 70 |

71 | 72 | 73 | 74 | 75 |
76 |

77 | 78 | 79 | Link to this section 80 | 81 | Summary 82 |

83 | 84 | 85 | 86 |
87 |

88 | Functions 89 |

90 |
91 | 94 | 95 |
96 | 97 |
98 | 99 | 100 | 101 | 102 |
103 | 104 | 105 | 106 | 107 | 108 |
109 |

110 | 111 | 112 | Link to this section 113 | 114 | Functions 115 |

116 |
117 | 118 | 119 | 120 | 121 |
122 | 123 | 124 | Link to this function 125 | 126 | new(map_or_kwlist, opts \\ []) 127 | 128 | 129 | 130 |
131 | 132 |
new(ExConstructor.map_or_kwlist, Keyword.t) :: %FFNerd.DepthChart.Player{depth: term, player_id: term, player_name: term, position: term, team: term}
133 | 134 |
135 | 136 |
137 |
138 | 139 |
140 |
141 | 142 |
143 | 144 | 145 | 146 | 159 |
160 |
161 |
162 |
163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /doc/FFNerd.DraftProjection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.DraftProjection – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.DraftProjection 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Draft Projection resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#draft-projections

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 | 100 | 101 |

Return a single draft ranking projection record by person id

102 |
103 | 104 |
105 |
106 | 109 | 110 |

Return a list of draft projection records by position

111 |
112 | 113 |
114 |
115 |
116 | new(map) 117 |
118 | 119 |

Convert raw api data to DraftProjection struct

120 |
121 | 122 |
123 | 124 |
125 | 126 | 127 | 128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 |
136 |

137 | 138 | 139 | Link to this section 140 | 141 | Functions 142 |

143 |
144 | 145 | 146 |
147 | 148 | 149 | Link to this function 150 | 151 | find(id, position, client) 152 | 153 | 154 | 155 |
156 |
157 |

Return a single draft ranking projection record by person id.

158 |

159 | 160 | Examples 161 |

162 | 163 |

FFNerd.DraftProjection.find 259, client

164 | 165 |
166 |
167 |
168 | 169 | 170 |
171 | 172 | 173 | Link to this function 174 | 175 | list(position, client) 176 | 177 | 178 | 179 |
180 |
181 |

Return a list of draft projection records by position.

182 |

183 | 184 | Examples 185 |

186 | 187 |

FFNerd.DraftProjection.list “QB”, client

188 | 189 |
190 |
191 |
192 | 193 | 194 |
195 | 196 | 197 | Link to this function 198 | 199 | new(map) 200 | 201 | 202 | 203 |
204 |
205 |

Convert raw api data to DraftProjection struct.

206 | 207 |
208 |
209 | 210 |
211 | 212 | 213 | 214 | 227 |
228 |
229 |
230 |
231 | 232 | 233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /doc/FFNerd.ExpertPick.Game.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.ExpertPick.Game – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.ExpertPick.Game 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s NFLPick resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#nfl-picks

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 | 100 | 101 |

Return an expert pick game record for current week by game id

102 |
103 | 104 |
105 |
106 |
107 | list(client) 108 |
109 | 110 |

Return a list of expert pick game records for current week

111 |
112 | 113 |
114 |
115 |
116 | new(map, game_id) 117 |
118 | 119 |

Convert raw api data to ExpertPick.Game struct

120 |
121 | 122 |
123 | 124 |
125 | 126 | 127 | 128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 |
136 |

137 | 138 | 139 | Link to this section 140 | 141 | Functions 142 |

143 |
144 | 145 | 146 |
147 | 148 | 149 | Link to this function 150 | 151 | find(game_id, client) 152 | 153 | 154 | 155 |
156 |
157 |

Return an expert pick game record for current week by game id.

158 |

159 | 160 | Examples 161 |

162 | 163 |

FFNerd.ExpertPick.Game.find 49, client

164 | 165 |
166 |
167 |
168 | 169 | 170 |
171 | 172 | 173 | Link to this function 174 | 175 | list(client) 176 | 177 | 178 | 179 |
180 |
181 |

Return a list of expert pick game records for current week.

182 |

183 | 184 | Examples 185 |

186 | 187 |

FFNerd.ExpertPick.Game.list client

188 | 189 |
190 |
191 |
192 | 193 | 194 |
195 | 196 | 197 | Link to this function 198 | 199 | new(map, game_id) 200 | 201 | 202 | 203 |
204 |
205 |

Convert raw api data to ExpertPick.Game struct.

206 | 207 |
208 |
209 | 210 |
211 | 212 | 213 | 214 | 227 |
228 |
229 |
230 |
231 | 232 | 233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /doc/FFNerd.ExpertPick.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.ExpertPick – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.ExpertPick 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s NFLPick resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#nfl-picks

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 | 100 | 101 |

Return an expert pick record for current week by game id and expert name

102 |
103 | 104 |
105 |
106 |
107 | list(game_id, client) 108 |
109 | 110 |

Return a list of expert pick records by game id

111 |
112 | 113 |
114 |
115 | 118 | 119 |
120 | 121 |
122 | 123 | 124 | 125 | 126 |
127 | 128 | 129 | 130 | 131 | 132 |
133 |

134 | 135 | 136 | Link to this section 137 | 138 | Functions 139 |

140 |
141 | 142 | 143 |
144 | 145 | 146 | Link to this function 147 | 148 | find(name, game_id, client) 149 | 150 | 151 | 152 |
153 |
154 |

Return an expert pick record for current week by game id and expert name.

155 |

156 | 157 | Examples 158 |

159 | 160 |

FFNerd.ExpertPick.find “Adam Meyer”, 49, client

161 | 162 |
163 |
164 |
165 | 166 | 167 |
168 | 169 | 170 | Link to this function 171 | 172 | list(game_id, client) 173 | 174 | 175 | 176 |
177 |
178 |

Return a list of expert pick records by game id.

179 |

180 | 181 | Examples 182 |

183 | 184 |

FFNerd.ExpertPick.list 49, client

185 | 186 |
187 |
188 |
189 | 190 | 191 | 192 | 193 |
194 | 195 | 196 | Link to this function 197 | 198 | new(map_or_kwlist, opts \\ []) 199 | 200 | 201 | 202 |
203 | 204 |
new(ExConstructor.map_or_kwlist, Keyword.t) :: %FFNerd.ExpertPick{correct: term, expert_company: term, expert_name: term, expert_season_correct: term, game_pick: term}
205 | 206 |
207 | 208 |
209 |
210 | 211 |
212 |
213 | 214 |
215 | 216 | 217 | 218 | 231 |
232 |
233 |
234 |
235 | 236 | 237 | 238 | 239 | 240 | -------------------------------------------------------------------------------- /doc/FFNerd.Game.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.Game – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.Game 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s NFL Schedule resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#schedule

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 |
98 | find(id, client) 99 |
100 | 101 |

Return a single game record by game id

102 |
103 | 104 |
105 |
106 |
107 | list(client) 108 |
109 | 110 |

Return a list of all game records

111 |
112 | 113 |
114 |
115 |
116 | new(map) 117 |
118 | 119 |

Convert raw api data to Game struct

120 |
121 | 122 |
123 | 124 |
125 | 126 | 127 | 128 | 129 |
130 | 131 | 132 | 133 | 134 | 135 |
136 |

137 | 138 | 139 | Link to this section 140 | 141 | Functions 142 |

143 |
144 | 145 | 146 |
147 | 148 | 149 | Link to this function 150 | 151 | find(id, client) 152 | 153 | 154 | 155 |
156 |
157 |

Return a single game record by game id.

158 |

159 | 160 | Examples 161 |

162 | 163 |

FFNerd.Game.find 2, client

164 | 165 |
166 |
167 |
168 | 169 | 170 |
171 | 172 | 173 | Link to this function 174 | 175 | list(client) 176 | 177 | 178 | 179 |
180 |
181 |

Return a list of all game records.

182 |

183 | 184 | Examples 185 |

186 | 187 |

FFNerd.Game.list client

188 | 189 |
190 |
191 |
192 | 193 | 194 |
195 | 196 | 197 | Link to this function 198 | 199 | new(map) 200 | 201 | 202 | 203 |
204 |
205 |

Convert raw api data to Game struct.

206 | 207 |
208 |
209 | 210 |
211 | 212 | 213 | 214 | 227 |
228 |
229 |
230 |
231 | 232 | 233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /doc/FFNerd.Player.Stats.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.Player.Stats – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.Player.Stats 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Player Stats resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#player

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 |
98 | find(id, client) 99 |
100 | 101 |

Return player stats record by id or FFNerd.Player struct

102 |
103 | 104 |
105 |
106 | 109 | 110 |

Return player stats record by id and year

111 |
112 | 113 |
114 |
115 | 118 | 119 |

Return player stats record by id, year, and week

120 |
121 | 122 |
123 |
124 |
125 | new(map) 126 |
127 | 128 |

Convert raw api data to Player.Stats struct

129 |
130 | 131 |
132 | 133 |
134 | 135 | 136 | 137 | 138 |
139 | 140 | 141 | 142 | 143 | 144 |
145 |

146 | 147 | 148 | Link to this section 149 | 150 | Functions 151 |

152 |
153 | 154 | 155 |
156 | 157 | 158 | Link to this function 159 | 160 | find(id, client) 161 | 162 | 163 | 164 |
165 |
166 |

Return player stats record by id or FFNerd.Player struct.

167 |

168 | 169 | Examples 170 |

171 | 172 |

FFNerd.Player.Stats.find 2, client

173 | 174 |
175 |
176 |
177 | 178 | 179 |
180 | 181 | 182 | Link to this function 183 | 184 | find(id, year, client) 185 | 186 | 187 | 188 |
189 |
190 |

Return player stats record by id and year.

191 |

192 | 193 | Examples 194 |

195 | 196 |

FFNerd.Player.Stats.find 2, 2009, client

197 | 198 |
199 |
200 |
201 | 202 | 203 |
204 | 205 | 206 | Link to this function 207 | 208 | find(id, year, week, client) 209 | 210 | 211 | 212 |
213 |
214 |

Return player stats record by id, year, and week.

215 |

216 | 217 | Examples 218 |

219 | 220 |

FFNerd.Player.Stats.find 2, 2009, 17, client

221 | 222 |
223 |
224 |
225 | 226 | 227 |
228 | 229 | 230 | Link to this function 231 | 232 | new(map) 233 | 234 | 235 | 236 |
237 |
238 |

Convert raw api data to Player.Stats struct.

239 | 240 |
241 |
242 | 243 |
244 | 245 | 246 | 247 | 260 |
261 |
262 |
263 |
264 | 265 | 266 | 267 | 268 | 269 | -------------------------------------------------------------------------------- /doc/FFNerd.Player.Video.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.Player.Video – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.Player.Video 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Player Videos resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#player

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 |
98 | list(id, client) 99 |
100 | 101 |

Return a list of player video records by player id

102 |
103 | 104 |
105 |
106 |
107 | new(map) 108 |
109 | 110 |

Convert raw api data to Player.Video struct

111 |
112 | 113 |
114 | 115 |
116 | 117 | 118 | 119 | 120 |
121 | 122 | 123 | 124 | 125 | 126 |
127 |

128 | 129 | 130 | Link to this section 131 | 132 | Functions 133 |

134 |
135 | 136 | 137 |
138 | 139 | 140 | Link to this function 141 | 142 | list(id, client) 143 | 144 | 145 | 146 |
147 |
148 |

Return a list of player video records by player id.

149 |

150 | 151 | Examples 152 |

153 | 154 |

FFNerd.Player.Video.list 14, client

155 | 156 |
157 |
158 |
159 | 160 | 161 |
162 | 163 | 164 | Link to this function 165 | 166 | new(map) 167 | 168 | 169 | 170 |
171 |
172 |

Convert raw api data to Player.Video struct.

173 | 174 |
175 |
176 | 177 |
178 | 179 | 180 | 181 | 194 |
195 |
196 |
197 |
198 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /doc/FFNerd.Player.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.Player – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.Player 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Players resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#players

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 |
98 | find(id, client) 99 |
100 | 101 |

Return a single player record by player id or display name

102 |
103 | 104 |
105 |
106 |
107 | list(client) 108 |
109 | 110 |

Return a list of all player records

111 |
112 | 113 |
114 |
115 | 118 | 119 |

Return a list of player records by position code

120 |
121 | 122 |
123 |
124 | 127 | 128 |
129 | 130 |
131 | 132 | 133 | 134 | 135 |
136 | 137 | 138 | 139 | 140 | 141 |
142 |

143 | 144 | 145 | Link to this section 146 | 147 | Functions 148 |

149 |
150 | 151 | 152 |
153 | 154 | 155 | Link to this function 156 | 157 | find(id, client) 158 | 159 | 160 | 161 |
162 |
163 |

Return a single player record by player id or display name

164 |

165 | 166 | Examples 167 |

168 | 169 |

FFNerd.Player.find 2, client 170 | FFNerd.Player.find “Russell Wilson”, client

171 | 172 |
173 |
174 |
175 | 176 | 177 |
178 | 179 | 180 | Link to this function 181 | 182 | list(client) 183 | 184 | 185 | 186 |
187 |
188 |

Return a list of all player records.

189 |

190 | 191 | Examples 192 |

193 | 194 |

FFNerd.Player.list client

195 | 196 |
197 |
198 |
199 | 200 | 201 |
202 | 203 | 204 | Link to this function 205 | 206 | list(position, client) 207 | 208 | 209 | 210 |
211 |
212 |

Return a list of player records by position code.

213 |

214 | 215 | Examples 216 |

217 | 218 |

FFNerd.Player.list “QB”, client

219 | 220 |
221 |
222 |
223 | 224 | 225 | 226 | 227 |
228 | 229 | 230 | Link to this function 231 | 232 | new(map_or_kwlist, opts \\ []) 233 | 234 | 235 | 236 |
237 | 238 |
new(ExConstructor.map_or_kwlist, Keyword.t) :: %FFNerd.Player{active: term, college: term, display_name: term, dob: term, fname: term, height: term, jersey: term, lname: term, player_id: term, position: term, star: term, team: term, twitter_id: term, weight: term}
239 | 240 |
241 | 242 |
243 |
244 | 245 |
246 |
247 | 248 |
249 | 250 | 251 | 252 | 265 |
266 |
267 |
268 |
269 | 270 | 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /doc/FFNerd.Schedule.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.Schedule – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.Schedule 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s NFL Schedule resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#schedule

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 | 100 | 101 |

Return the associated current week

102 |
103 | 104 |
105 |
106 |
107 | find(id, client) 108 |
109 | 110 |

Return a single game record by game id

111 |
112 | 113 |
114 |
115 |
116 | list(client) 117 |
118 | 119 |

Return a list of all game records

120 |
121 | 122 |
123 |
124 |
125 | list(team, client) 126 |
127 | 128 |

Return a list of game records by team code

129 |
130 | 131 |
132 | 133 |
134 | 135 | 136 | 137 | 138 |
139 | 140 | 141 | 142 | 143 | 144 |
145 |

146 | 147 | 148 | Link to this section 149 | 150 | Functions 151 |

152 |
153 | 154 | 155 |
156 | 157 | 158 | Link to this function 159 | 160 | current_week(client) 161 | 162 | 163 | 164 |
165 |
166 |

Return the associated current week.

167 |

168 | 169 | Examples 170 |

171 | 172 |

FFNerd.Schedule.current_week client

173 | 174 |
175 |
176 |
177 | 178 | 179 |
180 | 181 | 182 | Link to this function 183 | 184 | find(id, client) 185 | 186 | 187 | 188 |
189 |
190 |

Return a single game record by game id.

191 |

192 | 193 | Examples 194 |

195 | 196 |

FFNerd.Schedule.list client

197 | 198 |
199 |
200 |
201 | 202 | 203 |
204 | 205 | 206 | Link to this function 207 | 208 | list(client) 209 | 210 | 211 | 212 |
213 |
214 |

Return a list of all game records.

215 |

216 | 217 | Examples 218 |

219 | 220 |

FFNerd.Schedule.list client

221 | 222 |
223 |
224 |
225 | 226 | 227 |
228 | 229 | 230 | Link to this function 231 | 232 | list(team, client) 233 | 234 | 235 | 236 |
237 |
238 |

Return a list of game records by team code.

239 |

240 | 241 | Examples 242 |

243 | 244 |

FFNerd.Schedule.list client

245 | 246 |
247 |
248 | 249 |
250 | 251 | 252 | 253 | 266 |
267 |
268 |
269 |
270 | 271 | 272 | 273 | 274 | 275 | -------------------------------------------------------------------------------- /doc/FFNerd.Team.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.Team – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.Team 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Bye Week resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#teams

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 |
98 | find(team, client) 99 |
100 | 101 |

Return a single team record by team code

102 |
103 | 104 |
105 |
106 |
107 | list(client) 108 |
109 | 110 |

Return a list of all team records

111 |
112 | 113 |
114 |
115 | 118 | 119 |
120 | 121 |
122 | 123 | 124 | 125 | 126 |
127 | 128 | 129 | 130 | 131 | 132 |
133 |

134 | 135 | 136 | Link to this section 137 | 138 | Functions 139 |

140 |
141 | 142 | 143 |
144 | 145 | 146 | Link to this function 147 | 148 | find(team, client) 149 | 150 | 151 | 152 |
153 |
154 |

Return a single team record by team code.

155 |

156 | 157 | Examples 158 |

159 | 160 |

FFNerd.Team.find “SEA”, client

161 | 162 |
163 |
164 |
165 | 166 | 167 |
168 | 169 | 170 | Link to this function 171 | 172 | list(client) 173 | 174 | 175 | 176 |
177 |
178 |

Return a list of all team records.

179 |

180 | 181 | Examples 182 |

183 | 184 |

FFNerd.Team.list client

185 | 186 |
187 |
188 |
189 | 190 | 191 | 192 | 193 |
194 | 195 | 196 | Link to this function 197 | 198 | new(map_or_kwlist, opts \\ []) 199 | 200 | 201 | 202 |
203 | 204 |
new(ExConstructor.map_or_kwlist, Keyword.t) :: %FFNerd.Team{code: term, full_name: term, short_name: term}
205 | 206 |
207 | 208 |
209 |
210 | 211 |
212 |
213 | 214 |
215 | 216 | 217 | 218 | 231 |
232 |
233 |
234 |
235 | 236 | 237 | 238 | 239 | 240 | -------------------------------------------------------------------------------- /doc/FFNerd.URL.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.URL – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.URL 69 | 70 |

71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 94 |
95 |
96 |
97 |
98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /doc/FFNerd.Weather.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.Weather – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.Weather 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Weather Forecasts resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#weather

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 | 100 | 101 |

Return the associated current date

102 |
103 | 104 |
105 |
106 |
107 | current_week(client) 108 |
109 | 110 |

Return the associated current week

111 |
112 | 113 |
114 |
115 |
116 | find(id, client) 117 |
118 | 119 |

Return a single weather forecast record by team code

120 |
121 | 122 |
123 |
124 |
125 | list(client) 126 |
127 | 128 |

Return a list of all weather forecast records

129 |
130 | 131 |
132 |
133 |
134 | new(map) 135 |
136 | 137 |

Convert raw api data to Weather struct

138 |
139 | 140 |
141 | 142 |
143 | 144 | 145 | 146 | 147 |
148 | 149 | 150 | 151 | 152 | 153 |
154 |

155 | 156 | 157 | Link to this section 158 | 159 | Functions 160 |

161 |
162 | 163 | 164 |
165 | 166 | 167 | Link to this function 168 | 169 | current_date(client) 170 | 171 | 172 | 173 |
174 |
175 |

Return the associated current date.

176 |

177 | 178 | Examples 179 |

180 | 181 |

FFNerd.Schedule.today client

182 | 183 |
184 |
185 |
186 | 187 | 188 |
189 | 190 | 191 | Link to this function 192 | 193 | current_week(client) 194 | 195 | 196 | 197 |
198 |
199 |

Return the associated current week.

200 |

201 | 202 | Examples 203 |

204 | 205 |

FFNerd.Schedule.week client

206 | 207 |
208 |
209 |
210 | 211 | 212 |
213 | 214 | 215 | Link to this function 216 | 217 | find(id, client) 218 | 219 | 220 | 221 |
222 |
223 |

Return a single weather forecast record by team code.

224 |

225 | 226 | Examples 227 |

228 | 229 |

FFNerd.Weather.find “SEA”, client

230 | 231 |
232 |
233 |
234 | 235 | 236 |
237 | 238 | 239 | Link to this function 240 | 241 | list(client) 242 | 243 | 244 | 245 |
246 |
247 |

Return a list of all weather forecast records.

248 |

249 | 250 | Examples 251 |

252 | 253 |

FFNerd.Schedule.list client

254 | 255 |
256 |
257 |
258 | 259 | 260 |
261 | 262 | 263 | Link to this function 264 | 265 | new(map) 266 | 267 | 268 | 269 |
270 |
271 |

Convert raw api data to Weather struct.

272 | 273 |
274 |
275 | 276 |
277 | 278 | 279 | 280 | 293 |
294 |
295 |
296 |
297 | 298 | 299 | 300 | 301 | 302 | -------------------------------------------------------------------------------- /doc/FFNerd.WeeklyIDPRanking.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.WeeklyIDPRanking – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.WeeklyIDPRanking 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Weekly Ranking resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#weekly-idp

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 |
98 | list(client) 99 |
100 | 101 |

Return a list of weekly idp ranking records

102 |
103 | 104 |
105 |
106 | 109 | 110 |

Return a list of weekly idp ranking records by position using the current week

111 |
112 | 113 |
114 |
115 | 118 | 119 |
120 | 121 |
122 | 123 | 124 | 125 | 126 |
127 | 128 | 129 | 130 | 131 | 132 |
133 |

134 | 135 | 136 | Link to this section 137 | 138 | Functions 139 |

140 |
141 | 142 | 143 |
144 | 145 | 146 | Link to this function 147 | 148 | list(client) 149 | 150 | 151 | 152 |
153 |
154 |

Return a list of weekly idp ranking records.

155 |

156 | 157 | Examples 158 |

159 | 160 |

FFNerd.WeeklyIDPRanking.list client

161 |

FFNerd.WeeklyIDPRankingDraftRanking.list :ppr, client

162 | 163 |
164 |
165 |
166 | 167 | 168 |
169 | 170 | 171 | Link to this function 172 | 173 | list(position, client) 174 | 175 | 176 | 177 |
178 |
179 |

Return a list of weekly idp ranking records by position using the current week.

180 |

181 | 182 | Examples 183 |

184 | 185 |

FFNerd.WeeklyIDPRanking.list “DE”, client

186 | 187 |
188 |
189 |
190 | 191 | 192 | 193 | 194 |
195 | 196 | 197 | Link to this function 198 | 199 | new(map_or_kwlist, opts \\ []) 200 | 201 | 202 | 203 |
204 | 205 |
new(ExConstructor.map_or_kwlist, Keyword.t) :: %FFNerd.WeeklyIDPRanking{player: term, position: term, rank: term, team: term}
206 | 207 |
208 | 209 |
210 |
211 | 212 |
213 |
214 | 215 |
216 | 217 | 218 | 219 | 232 |
233 |
234 |
235 |
236 | 237 | 238 | 239 | 240 | 241 | -------------------------------------------------------------------------------- /doc/FFNerd.WeeklyRanking.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FFNerd.WeeklyRanking – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 66 |

67 | ffnerd v0.2.1 68 | FFNerd.WeeklyRanking 69 | 70 |

71 | 72 | 73 |
74 |

Provides functions to work with Fantasy Football Nerd’s Weekly Ranking resources.

75 |

More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#weekly-rankings

76 | 77 |
78 | 79 | 80 | 81 |
82 |

83 | 84 | 85 | Link to this section 86 | 87 | Summary 88 |

89 | 90 | 91 | 92 |
93 |

94 | Functions 95 |

96 |
97 | 100 | 101 |

Return a single weekly ranking record by person id

102 |
103 | 104 |
105 |
106 | 109 | 110 |

Return a list of weekly ranking records by position using the current week

111 |
112 | 113 |
114 |
115 | 118 | 119 |

Return a list of weekly ranking records by position and week

120 |
121 | 122 |
123 |
124 | 127 | 128 |
129 | 130 |
131 | 132 | 133 | 134 | 135 |
136 | 137 | 138 | 139 | 140 | 141 |
142 |

143 | 144 | 145 | Link to this section 146 | 147 | Functions 148 |

149 |
150 | 151 | 152 |
153 | 154 | 155 | Link to this function 156 | 157 | find(id, position, client) 158 | 159 | 160 | 161 |
162 |
163 |

Return a single weekly ranking record by person id.

164 |

165 | 166 | Examples 167 |

168 | 169 |

FFNerd.WeeklyRanking.find 259, client

170 | 171 |
172 |
173 |
174 | 175 | 176 |
177 | 178 | 179 | Link to this function 180 | 181 | list(position, client) 182 | 183 | 184 | 185 |
186 |
187 |

Return a list of weekly ranking records by position using the current week.

188 |

189 | 190 | Examples 191 |

192 | 193 |

FFNerd.WeeklyRanking.list “QB”, client

194 | 195 |
196 |
197 |
198 | 199 | 200 |
201 | 202 | 203 | Link to this function 204 | 205 | list(position, week, client) 206 | 207 | 208 | 209 |
210 |
211 |

Return a list of weekly ranking records by position and week.

212 |

213 | 214 | Examples 215 |

216 | 217 |

FFNerd.WeeklyRanking.list “QB”, client

218 | 219 |
220 |
221 |
222 | 223 | 224 | 225 | 226 |
227 | 228 | 229 | Link to this function 230 | 231 | new(map_or_kwlist, opts \\ []) 232 | 233 | 234 | 235 |
236 | 237 |
new(ExConstructor.map_or_kwlist, Keyword.t) :: %FFNerd.WeeklyRanking{game_status: term, injury: term, last_update: term, name: term, player_id: term, position: term, ppr: term, ppr_high: term, ppr_low: term, practice_status: term, standard: term, standard_high: term, standard_low: term, team: term, week: term}
238 | 239 |
240 | 241 |
242 |
243 | 244 |
245 |
246 | 247 |
248 | 249 | 250 | 251 | 264 |
265 |
266 |
267 |
268 | 269 | 270 | 271 | 272 | 273 | -------------------------------------------------------------------------------- /doc/dist/sidebar_items-6b1fe30cb7.js: -------------------------------------------------------------------------------- 1 | sidebarNodes={"extras":[{"id":"api-reference","title":"API Reference","group":"","headers":[{"id":"Modules","anchor":"modules"}]}],"exceptions":[],"modules":[{"id":"FFNerd","title":"FFNerd","functions":[{"id":"build_url/1","anchor":"build_url/1"},{"id":"delete/3","anchor":"delete/3"},{"id":"delete!/3","anchor":"delete!/3"},{"id":"get/2","anchor":"get/2"},{"id":"get/3","anchor":"get/3"},{"id":"get!/3","anchor":"get!/3"},{"id":"head/3","anchor":"head/3"},{"id":"head!/3","anchor":"head!/3"},{"id":"options/3","anchor":"options/3"},{"id":"options!/3","anchor":"options!/3"},{"id":"patch/4","anchor":"patch/4"},{"id":"patch!/4","anchor":"patch!/4"},{"id":"post/4","anchor":"post/4"},{"id":"post!/4","anchor":"post!/4"},{"id":"process_headers/1","anchor":"process_headers/1"},{"id":"process_request_body/1","anchor":"process_request_body/1"},{"id":"process_request_headers/1","anchor":"process_request_headers/1"},{"id":"process_request_options/1","anchor":"process_request_options/1"},{"id":"process_response_body/1","anchor":"process_response_body/1"},{"id":"process_response_chunk/1","anchor":"process_response_chunk/1"},{"id":"process_status_code/1","anchor":"process_status_code/1"},{"id":"process_url/1","anchor":"process_url/1"},{"id":"put/4","anchor":"put/4"},{"id":"put!/4","anchor":"put!/4"},{"id":"request/5","anchor":"request/5"},{"id":"request!/5","anchor":"request!/5"},{"id":"start/0","anchor":"start/0"},{"id":"stream_next/1","anchor":"stream_next/1"}],"types":[{"id":"body/0","anchor":"t:body/0"},{"id":"headers/0","anchor":"t:headers/0"}]},{"id":"FFNerd.AuctionValue","title":"FFNerd.AuctionValue","functions":[{"id":"find/2","anchor":"find/2"},{"id":"find/3","anchor":"find/3"},{"id":"list/1","anchor":"list/1"},{"id":"list/2","anchor":"list/2"},{"id":"list/3","anchor":"list/3"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.ByeWeek","title":"FFNerd.ByeWeek","functions":[{"id":"find/2","anchor":"find/2"},{"id":"list/1","anchor":"list/1"},{"id":"list/2","anchor":"list/2"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.Client","title":"FFNerd.Client","functions":[{"id":"new/1","anchor":"new/1"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.DefenseRanking","title":"FFNerd.DefenseRanking","functions":[{"id":"find/2","anchor":"find/2"},{"id":"list/1","anchor":"list/1"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.DepthChart","title":"FFNerd.DepthChart","functions":[{"id":"find/2","anchor":"find/2"},{"id":"find/3","anchor":"find/3"},{"id":"find/4","anchor":"find/4"},{"id":"list/1","anchor":"list/1"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.DepthChart.Player","title":"FFNerd.DepthChart.Player","functions":[{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.DraftProjection","title":"FFNerd.DraftProjection","functions":[{"id":"find/3","anchor":"find/3"},{"id":"list/2","anchor":"list/2"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.DraftRanking","title":"FFNerd.DraftRanking","functions":[{"id":"find/2","anchor":"find/2"},{"id":"find/3","anchor":"find/3"},{"id":"list/1","anchor":"list/1"},{"id":"list/2","anchor":"list/2"},{"id":"list/3","anchor":"list/3"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.ExpertPick","title":"FFNerd.ExpertPick","functions":[{"id":"find/3","anchor":"find/3"},{"id":"list/2","anchor":"list/2"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.ExpertPick.Game","title":"FFNerd.ExpertPick.Game","functions":[{"id":"find/2","anchor":"find/2"},{"id":"list/1","anchor":"list/1"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.Game","title":"FFNerd.Game","functions":[{"id":"find/2","anchor":"find/2"},{"id":"list/1","anchor":"list/1"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.Inactive","title":"FFNerd.Inactive","functions":[{"id":"find/2","anchor":"find/2"},{"id":"find/3","anchor":"find/3"},{"id":"list/1","anchor":"list/1"},{"id":"list/2","anchor":"list/2"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.Injury","title":"FFNerd.Injury","functions":[{"id":"find/3","anchor":"find/3"},{"id":"find/4","anchor":"find/4"},{"id":"list/1","anchor":"list/1"},{"id":"list/2","anchor":"list/2"},{"id":"list/3","anchor":"list/3"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.Player","title":"FFNerd.Player","functions":[{"id":"find/2","anchor":"find/2"},{"id":"list/1","anchor":"list/1"},{"id":"list/2","anchor":"list/2"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.Player.Stats","title":"FFNerd.Player.Stats","functions":[{"id":"find/2","anchor":"find/2"},{"id":"find/3","anchor":"find/3"},{"id":"find/4","anchor":"find/4"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.Player.Video","title":"FFNerd.Player.Video","functions":[{"id":"list/2","anchor":"list/2"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.Schedule","title":"FFNerd.Schedule","functions":[{"id":"current_week/1","anchor":"current_week/1"},{"id":"find/2","anchor":"find/2"},{"id":"list/1","anchor":"list/1"},{"id":"list/2","anchor":"list/2"}]},{"id":"FFNerd.Team","title":"FFNerd.Team","functions":[{"id":"find/2","anchor":"find/2"},{"id":"list/1","anchor":"list/1"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.URL","title":"FFNerd.URL"},{"id":"FFNerd.Weather","title":"FFNerd.Weather","functions":[{"id":"current_date/1","anchor":"current_date/1"},{"id":"current_week/1","anchor":"current_week/1"},{"id":"find/2","anchor":"find/2"},{"id":"list/1","anchor":"list/1"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.WeeklyIDPRanking","title":"FFNerd.WeeklyIDPRanking","functions":[{"id":"list/1","anchor":"list/1"},{"id":"list/2","anchor":"list/2"},{"id":"new/2","anchor":"new/2"}]},{"id":"FFNerd.WeeklyProjection","title":"FFNerd.WeeklyProjection","functions":[{"id":"find/3","anchor":"find/3"},{"id":"find/4","anchor":"find/4"},{"id":"list/2","anchor":"list/2"},{"id":"list/3","anchor":"list/3"},{"id":"new/1","anchor":"new/1"}]},{"id":"FFNerd.WeeklyRanking","title":"FFNerd.WeeklyRanking","functions":[{"id":"find/3","anchor":"find/3"},{"id":"list/2","anchor":"list/2"},{"id":"list/3","anchor":"list/3"},{"id":"new/2","anchor":"new/2"}]}],"protocols":[],"tasks":[]} -------------------------------------------------------------------------------- /doc/fonts/icomoon.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jessejanderson/ffnerd-api-elixir/75b0a99ae2f085c2f250b32f065d31b4cb14b7f4/doc/fonts/icomoon.eot -------------------------------------------------------------------------------- /doc/fonts/icomoon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Generated by IcoMoon 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/fonts/icomoon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jessejanderson/ffnerd-api-elixir/75b0a99ae2f085c2f250b32f065d31b4cb14b7f4/doc/fonts/icomoon.ttf -------------------------------------------------------------------------------- /doc/fonts/icomoon.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jessejanderson/ffnerd-api-elixir/75b0a99ae2f085c2f250b32f065d31b4cb14b7f4/doc/fonts/icomoon.woff -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ffnerd v0.2.1 – Documentation 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /doc/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Search – ffnerd v0.2.1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 22 | 60 | 61 |
62 |
63 |
64 | 65 | 68 | 81 |
82 |
83 |
84 |
85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /lib/ffnerd.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd do 2 | use HTTPoison.Base 3 | 4 | # TODO: Get these values dynamically 5 | @format "json" 6 | 7 | def get({atom, %FFNerd.URL{} = url_struct}, %FFNerd.Client{auth: auth}) do 8 | %FFNerd.URL{url_struct | api_key: auth} 9 | |> FFNerd.build_url 10 | |> FFNerd.get! 11 | |> do_get(atom) 12 | end 13 | defp do_get(raw, :none), do: raw.body 14 | defp do_get(raw, atom), do: raw.body[atom] 15 | 16 | def build_url(%FFNerd.URL{service: service, format: _format, api_key: api_key, path1: path1, path2: path2, path3: path3}) do 17 | "#{service}/#{@format}/#{api_key}/#{path1}/#{path2}/#{path3}" 18 | |> String.strip(?/) 19 | end 20 | 21 | def process_url(url) do 22 | "https://www.fantasyfootballnerd.com/service/" <> url 23 | end 24 | 25 | def process_response_body(body) do 26 | body 27 | |> Poison.decode! 28 | |> Enum.map(fn({k, v}) -> {String.to_atom(k), v} end) 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/ffnerd/auction_value.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.AuctionValue do 2 | defstruct [:avg_price, :display_name, :max_price, :min_price, :player_id, :position, :ppr, :team] 3 | use ExConstructor 4 | 5 | @moduledoc """ 6 | Provides functions to work with Fantasy Football Nerd's Auction Values resources. 7 | 8 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#auction 9 | """ 10 | 11 | @doc """ 12 | Return a list of auction value records. 13 | 14 | ## Examples 15 | 16 | FFNerd.AuctionValue.list client 17 | 18 | FFNerd.AuctionValue.list :ppr, client 19 | 20 | """ 21 | def list(client) do 22 | {:AuctionValues, %FFNerd.URL{service: "auction"}} 23 | |> FFNerd.get(client) 24 | |> Enum.map(&new/1) 25 | end 26 | 27 | def list(:ppr, client) do 28 | {:AuctionValues, %FFNerd.URL{service: "auction", path1: "ppr"}} 29 | |> FFNerd.get(client) 30 | |> Enum.map(&new/1) 31 | end 32 | 33 | @doc """ 34 | Return a list of auction value records by position. 35 | 36 | ## Examples 37 | 38 | FFNerd.AuctionValue.list "QB", client 39 | 40 | FFNerd.AuctionValue.list :ppr, "QB", client 41 | 42 | """ 43 | def list(position, client) do 44 | list(client) |> Enum.filter(&(&1.position == position)) 45 | end 46 | 47 | def list(:ppr, position, client) do 48 | list(:ppr, client) |> Enum.filter(&(&1.position == position)) 49 | end 50 | 51 | @doc """ 52 | Return a single auction value record by person id. 53 | 54 | ## Examples 55 | 56 | FFNerd.AuctionValue.find 259, client 57 | 58 | FFNerd.AuctionValue.find :ppr, 259, client 59 | 60 | """ 61 | def find(id, client) do 62 | list(client) |> Enum.find(&(&1.player_id == "#{id}")) 63 | end 64 | 65 | def find(:ppr, id, client) do 66 | list(:ppr, client) |> Enum.find(&(&1.player_id == "#{id}")) 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /lib/ffnerd/bye-week.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.ByeWeek do 2 | defstruct [:bye_week, :display_name, :team] 3 | use ExConstructor 4 | 5 | @moduledoc """ 6 | Provides functions to work with Fantasy Football Nerd's Bye Week resources. 7 | 8 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#byes 9 | """ 10 | 11 | @doc """ 12 | Return a list of all bye week records. 13 | 14 | ## Examples 15 | 16 | FFNerd.ByeWeek.list 4, client 17 | 18 | """ 19 | def list(client) do 20 | {:none, %FFNerd.URL{service: "byes"}} 21 | |> FFNerd.get(client) 22 | |> Stream.flat_map(fn{_, v} -> v end) 23 | |> Enum.map(&new/1) 24 | end 25 | 26 | @doc """ 27 | Return a list of bye week records by week number. 28 | 29 | ## Examples 30 | 31 | FFNerd.ByeWeek.list 4, client 32 | 33 | """ 34 | def list(id, client) do 35 | client |> list |> Enum.filter(&(&1.bye_week == "#{id}")) 36 | end 37 | 38 | @doc """ 39 | Return a single bye week record by team code. 40 | 41 | ## Examples 42 | 43 | FFNerd.ByeWeek.find "SEA", client 44 | 45 | """ 46 | def find(team, client) do 47 | client |> list |> Enum.find(&(&1.team == team)) 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/ffnerd/client.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Client do 2 | defstruct auth: nil, endpoint: "https://www.fantasyfootballnerd.com" 3 | 4 | @doc """ 5 | Create new client with default endpoint. 6 | 7 | ## Examples 8 | 9 | FFNerd.Client.new "API-KEY-ABC-XYZ" 10 | 11 | """ 12 | def new(auth), do: %__MODULE__{auth: auth} 13 | 14 | @doc """ 15 | Create new client with custom endpoint. 16 | 17 | ## Examples 18 | 19 | FFNerd.Client.new "API-KEY", "http://www.example.com" 20 | 21 | """ 22 | def new(auth, endpoint), do: %__MODULE__{auth: auth, endpoint: endpoint} 23 | end 24 | -------------------------------------------------------------------------------- /lib/ffnerd/defense_ranking.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DefenseRanking do 2 | defstruct [ 3 | :pass_yards_per_game, 4 | :pass_yards_per_game_rank, 5 | :points_per_game, 6 | :points_per_game_rank, 7 | :rush_yards_per_game, 8 | :rush_yards_per_game_rank, 9 | :team, 10 | :team_name, 11 | :total_yards_per_game, 12 | :total_yards_per_game_rank, 13 | ] 14 | 15 | @moduledoc """ 16 | Provides functions to work with Fantasy Football Nerd's Defense Ranking resources. 17 | 18 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#defense-rankings 19 | """ 20 | 21 | @doc """ 22 | Convert raw api data to Player.DefenseRanking struct. 23 | """ 24 | def new(map) do 25 | %FFNerd.DefenseRanking{ 26 | pass_yards_per_game: map["passingYardsPerGame"], 27 | pass_yards_per_game_rank: map["pypgRank"], 28 | points_per_game: map["pointsPerGame"], 29 | points_per_game_rank: map["ppgRank"], 30 | rush_yards_per_game: map["rushingYardsPerGame"], 31 | rush_yards_per_game_rank: map["rypgRank"], 32 | team: map["team"], 33 | team_name: map["teamName"], 34 | total_yards_per_game: map["yardsPerGame"], 35 | total_yards_per_game_rank: map["ypgRank"], 36 | } 37 | end 38 | 39 | @doc """ 40 | Return a list of defense ranking records. 41 | 42 | ## Examples 43 | 44 | FFNerd.DefenseRanking.list client 45 | 46 | """ 47 | def list(client) do 48 | {:DefenseRankings, %FFNerd.URL{service: "defense-rankings"}} 49 | |> FFNerd.get(client) 50 | |> Enum.map(&new/1) 51 | end 52 | 53 | @doc """ 54 | Return a defense ranking record by team code. 55 | 56 | ## Examples 57 | 58 | FFNerd.DefenseRanking.find "SEA", client 59 | 60 | """ 61 | def find(team, client) do 62 | list(client) |> Enum.find(&(&1.team == "#{team}")) 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /lib/ffnerd/depth_chart.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DepthChart do 2 | defstruct [:fb, :qb, :rb, :te, :wr1, :wr2] 3 | alias FFNerd.DepthChart.Player 4 | 5 | @positions ~w[FB QB RB TE WR1 WR2] 6 | 7 | @moduledoc """ 8 | Provides functions to work with Fantasy Football Nerd's Depth Chart resources. 9 | 10 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#depth-charts 11 | """ 12 | 13 | @doc """ 14 | Convert raw api data to DepthChart struct. 15 | """ 16 | def new(map) do 17 | %FFNerd.DepthChart{ 18 | fb: map["FB"], 19 | qb: map["QB"], 20 | rb: map["RB"], 21 | te: map["TE"], 22 | wr1: map["WR1"], 23 | wr2: map["WR2"], 24 | } 25 | end 26 | 27 | @doc """ 28 | Return a list of depth chart records. 29 | 30 | ## Examples 31 | 32 | FFNerd.DepthChart.list client 33 | 34 | """ 35 | def list(client) do 36 | {:DepthCharts, %FFNerd.URL{service: "depth-charts"}} 37 | |> FFNerd.get(client) 38 | |> Enum.map(fn{k, v} -> 39 | {k, Enum.map(v, fn{k, v} -> 40 | {k, Enum.map(v, fn(x) -> 41 | Player.new(x) 42 | end)} 43 | end) |> Enum.into(%{}) |> new} 44 | end) 45 | |> Enum.into(%{}) 46 | end 47 | 48 | @doc """ 49 | Return a team's depth chart record by team code. 50 | 51 | ## Examples 52 | 53 | FFNerd.DepthChart.find "SEA", client 54 | 55 | """ 56 | def find(team, client) do 57 | {:DepthCharts, %FFNerd.URL{service: "depth-charts"}} 58 | |> FFNerd.get(client) 59 | |> Map.get(team) 60 | |> Enum.map(fn{k, v} -> 61 | {k, Enum.map(v, fn(x) -> 62 | Player.new(x) 63 | end)} 64 | end) 65 | |> Enum.into(%{}) 66 | |> new 67 | end 68 | 69 | @doc """ 70 | Return a team's position depth chart record by team code and position. 71 | 72 | ## Examples 73 | 74 | FFNerd.DepthChart.find "SEA", "QB", client 75 | 76 | """ 77 | def find(team, position, client) when position in @positions do 78 | find(team, client) 79 | |> Map.get(convert_json_string_to_atom(position)) 80 | end 81 | 82 | @doc """ 83 | Return a depth chart player record by team code, position, and depth. 84 | 85 | ## Examples 86 | 87 | FFNerd.DepthChart.find "SEA", "QB", 1, client 88 | 89 | """ 90 | def find(team, position, depth, client) when position in @positions do 91 | find(team, position, client) 92 | |> Enum.find(fn(x) -> Map.get(x, :depth) == "#{depth}" end) 93 | end 94 | 95 | defp convert_json_string_to_atom(str), do: str |> String.downcase |> String.to_atom 96 | end 97 | -------------------------------------------------------------------------------- /lib/ffnerd/depth_chart/player.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DepthChart.Player do 2 | defstruct [ 3 | :depth, 4 | :player_id, 5 | :player_name, 6 | :position, 7 | :team, 8 | ] 9 | use ExConstructor 10 | end 11 | -------------------------------------------------------------------------------- /lib/ffnerd/draft_projection.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DraftProjection do 2 | defstruct [ 3 | :def_fumbles_recovered, 4 | :def_interceptions, 5 | :def_return_tds, 6 | :def_sacks, 7 | :def_tds, 8 | :display_name, 9 | :extra_points, 10 | :fantasy_points, 11 | :field_goals, 12 | :fumbles_lost, 13 | :pass_attempts, 14 | :pass_completions, 15 | :pass_interceptions, 16 | :pass_tds, 17 | :pass_yards, 18 | :player_id, 19 | :receptions, 20 | :rec_tds, 21 | :rec_yards, 22 | :rush_attempts, 23 | :rush_tds, 24 | :rush_yards, 25 | :team, 26 | ] 27 | 28 | @moduledoc """ 29 | Provides functions to work with Fantasy Football Nerd's Draft Projection resources. 30 | 31 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#draft-projections 32 | """ 33 | 34 | @doc """ 35 | Convert raw api data to DraftProjection struct. 36 | """ 37 | def new(map) do 38 | %FFNerd.DraftProjection{ 39 | def_fumbles_recovered: map["fumbleRec"], 40 | def_interceptions: map["interceptions"], 41 | def_return_tds: map["specialTeamTD"], 42 | def_sacks: map["sacks"], 43 | def_tds: map["TD"], 44 | display_name: map["displayName"], 45 | extra_points: map["xp"], 46 | fantasy_points: map["fantasyPoints"], 47 | field_goals: map["fg"], 48 | fumbles_lost: map["fumbles"], 49 | pass_attempts: map["attempts"], 50 | pass_completions: map["completions"], 51 | pass_interceptions: map["passingInt"], 52 | pass_tds: map["passingTD"], 53 | pass_yards: map["passingYards"], 54 | player_id: map["playerId"], 55 | receptions: map["rec"], 56 | rec_tds: map["recTD"], 57 | rec_yards: map["recYards"], 58 | rush_attempts: map["rushAtt"], 59 | rush_tds: map["rushTD"], 60 | rush_yards: map["rushYards"], 61 | team: map["team"] 62 | } 63 | end 64 | 65 | @doc """ 66 | Return a list of draft projection records by position. 67 | 68 | ## Examples 69 | 70 | FFNerd.DraftProjection.list "QB", client 71 | 72 | """ 73 | def list(position, client) do 74 | {:DraftProjections, %FFNerd.URL{service: "draft-projections", path1: position}} 75 | |> FFNerd.get(client) 76 | |> Enum.map(&new/1) 77 | end 78 | 79 | @doc """ 80 | Return a single draft ranking projection record by person id. 81 | 82 | ## Examples 83 | 84 | FFNerd.DraftProjection.find 259, client 85 | 86 | """ 87 | def find(id, position, client) do 88 | list(position, client) |> Enum.find(&(&1.player_id == "#{id}")) 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /lib/ffnerd/draft_ranking.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DraftRanking do 2 | defstruct [:bye_week, :display_name, :fname, :lname, :nerd_rank, :overall_rank, :ppr, :player_id, :position, :position_rank, :team] 3 | use ExConstructor 4 | 5 | @moduledoc """ 6 | Provides functions to work with Fantasy Football Nerd's Draft Ranking resources. 7 | 8 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#draft-rankings 9 | """ 10 | 11 | @doc """ 12 | Return a list of draft ranking records. 13 | 14 | ## Examples 15 | 16 | FFNerd.DraftRanking.list client 17 | 18 | FFNerd.DraftRanking.list :ppr, client 19 | 20 | """ 21 | def list(client) do 22 | {:DraftRankings, %FFNerd.URL{service: "draft-rankings"}} 23 | |> FFNerd.get(client) 24 | |> Enum.map(&new/1) 25 | end 26 | 27 | def list(:ppr, client) do 28 | {:DraftRankings, %FFNerd.URL{service: "draft-rankings", path1: "1"}} 29 | |> FFNerd.get(client) 30 | |> Enum.map(fn(x) -> new(x) |> Map.put(:ppr, "1") end) 31 | end 32 | 33 | @doc """ 34 | Return a list of draft ranking records by position. 35 | 36 | ## Examples 37 | 38 | FFNerd.DraftRanking.list "QB", client 39 | 40 | FFNerd.DraftRanking.list :ppr, "QB", client 41 | 42 | """ 43 | def list(position, client) do 44 | list(client) |> Enum.filter(&(&1.position == position)) 45 | end 46 | 47 | def list(:ppr, position, client) do 48 | list(:ppr, client) |> Enum.filter(&(&1.position == position)) 49 | end 50 | 51 | @doc """ 52 | Return a single draft ranking record by person id. 53 | 54 | ## Examples 55 | 56 | FFNerd.DraftRanking.find 259, client 57 | 58 | FFNerd.DraftRanking.find :ppr, 259, client 59 | 60 | """ 61 | def find(id, client) do 62 | list(client) |> Enum.find(&(&1.player_id == "#{id}")) 63 | end 64 | 65 | def find(:ppr, id, client) do 66 | list(:ppr, client) |> Enum.find(&(&1.player_id == "#{id}")) 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /lib/ffnerd/expert_pick.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.ExpertPick do 2 | defstruct [:correct, :expert_company, :expert_name, :game_pick, :expert_season_correct] 3 | use ExConstructor 4 | 5 | @moduledoc """ 6 | Provides functions to work with Fantasy Football Nerd's NFLPick resources. 7 | 8 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#nfl-picks 9 | """ 10 | 11 | @doc """ 12 | Return a list of expert pick records by game id. 13 | 14 | ## Examples 15 | 16 | FFNerd.ExpertPick.list 49, client 17 | 18 | """ 19 | def list(game_id, client) do 20 | {:games, %FFNerd.URL{service: "nfl-picks"}} 21 | |> FFNerd.get(client) 22 | |> Map.get("#{game_id}") 23 | |> Map.get("picks") 24 | |> Enum.map(&new/1) 25 | end 26 | 27 | @doc """ 28 | Return an expert pick record for current week by game id and expert name. 29 | 30 | ## Examples 31 | 32 | FFNerd.ExpertPick.find "Adam Meyer", 49, client 33 | 34 | """ 35 | def find(name, game_id, client) do 36 | list(game_id, client) |> Enum.find(&(&1.expert_name == "#{name}")) 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/ffnerd/expert_pick/game.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.ExpertPick.Game do 2 | defstruct [ 3 | :game_id, 4 | :away_team, 5 | :away_team_record, 6 | :consensus_count, 7 | :consensus_pick, 8 | :game_date, 9 | :game_time_et, 10 | :home_team, 11 | :home_team_record, 12 | :tv_station, 13 | :winner, 14 | :picks, 15 | ] 16 | 17 | @moduledoc """ 18 | Provides functions to work with Fantasy Football Nerd's NFLPick resources. 19 | 20 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#nfl-picks 21 | """ 22 | 23 | @doc """ 24 | Convert raw api data to ExpertPick.Game struct. 25 | """ 26 | def new(map, game_id) do 27 | %FFNerd.ExpertPick.Game{ 28 | game_id: game_id, 29 | away_team: map["awayTeam"], 30 | away_team_record: map["awayTeamRecord"], 31 | consensus_count: map["consensusCounts"], 32 | consensus_pick: map["consensusPick"], 33 | game_date: map["gameDate"], 34 | game_time_et: map["gameTimeET"], 35 | home_team: map["homeTeam"], 36 | home_team_record: map["homeTeamRecord"], 37 | picks: map["picks"], 38 | tv_station: map["tvStation"], 39 | winner: map["winner"], 40 | } 41 | end 42 | 43 | @doc """ 44 | Return a list of expert pick game records for current week. 45 | 46 | ## Examples 47 | 48 | FFNerd.ExpertPick.Game.list client 49 | 50 | """ 51 | def list(client) do 52 | {:games, %FFNerd.URL{service: "nfl-picks"}} 53 | |> FFNerd.get(client) 54 | |> Enum.map(fn{k, v} -> new(v, k) end) 55 | |> Enum.map(fn(x) -> 56 | Map.get_and_update(x, :picks, fn(current_val) -> 57 | {current_val, Enum.map(current_val, &FFNerd.ExpertPick.new/1)} 58 | end) |> elem(1) 59 | end) 60 | end 61 | 62 | @doc """ 63 | Return an expert pick game record for current week by game id. 64 | 65 | ## Examples 66 | 67 | FFNerd.ExpertPick.Game.find 49, client 68 | 69 | """ 70 | def find(game_id, client) do 71 | list(client) |> Enum.find(&(&1.game_id == "#{game_id}")) 72 | end 73 | end 74 | -------------------------------------------------------------------------------- /lib/ffnerd/game.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Game do 2 | defstruct [:game_id, :game_week, :game_date, :away_team, :home_team, :game_time_et, :tv_station] 3 | 4 | @moduledoc """ 5 | Provides functions to work with Fantasy Football Nerd's NFL Schedule resources. 6 | 7 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#schedule 8 | """ 9 | 10 | @doc """ 11 | Convert raw api data to Game struct. 12 | """ 13 | def new(map) do 14 | %FFNerd.Game{ 15 | game_id: map["gameId"], 16 | game_week: map["gameWeek"], 17 | game_date: map["gameDate"], 18 | away_team: map["awayTeam"], 19 | home_team: map["homeTeam"], 20 | game_time_et: map["gameTimeET"], 21 | tv_station: map["tvStation"], 22 | } 23 | end 24 | 25 | @doc """ 26 | Return a list of all game records. 27 | 28 | ## Examples 29 | 30 | FFNerd.Game.list client 31 | 32 | """ 33 | def list(client), do: FFNerd.Schedule.list(client) 34 | 35 | @doc """ 36 | Return a single game record by game id. 37 | 38 | ## Examples 39 | 40 | FFNerd.Game.find 2, client 41 | 42 | """ 43 | def find(id, client) do 44 | {:Schedule, %FFNerd.URL{service: "schedule"}} 45 | |> FFNerd.get(client) 46 | |> Enum.find(fn(%{"gameId" => game_id}) -> game_id == "#{id}" end) 47 | |> new 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/ffnerd/inactive.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Inactive do 2 | defstruct [ 3 | :display_name, 4 | :player_id, 5 | :position, 6 | :team, 7 | :week, 8 | :year, 9 | ] 10 | use ExConstructor 11 | 12 | @moduledoc """ 13 | Provides functions to work with Fantasy Football Nerd's Inactives resources. 14 | 15 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#inactives 16 | """ 17 | 18 | @doc """ 19 | Return a list of inactive records. 20 | 21 | ## Examples 22 | 23 | FFNerd.Inactive.list client 24 | 25 | """ 26 | def list(client) do 27 | {:Players, %FFNerd.URL{service: "inactives"}} 28 | |> FFNerd.get(client) 29 | |> Enum.map(&new/1) 30 | end 31 | 32 | @doc """ 33 | Return a list of inactive records by week. 34 | 35 | ## Examples 36 | 37 | FFNerd.Inactive.list 17, client 38 | 39 | """ 40 | def list(week, client) do 41 | {:Players, %FFNerd.URL{service: "inactives", path1: week}} 42 | |> FFNerd.get(client) 43 | |> Enum.map(&new/1) 44 | end 45 | 46 | @doc """ 47 | Return an inactive record by player id. 48 | 49 | ## Examples 50 | 51 | FFNerd.Inactive.find 1465, client 52 | 53 | """ 54 | def find(id, client) do 55 | list(client) |> Enum.find(&(&1.player_id == "#{id}")) 56 | end 57 | 58 | @doc """ 59 | Return an inactive record by player id and week. 60 | 61 | ## Examples 62 | 63 | FFNerd.Inactive.find 259, 17, client 64 | 65 | """ 66 | def find(id, week, client) do 67 | list(week, client) |> Enum.find(&(&1.player_id == "#{id}")) 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /lib/ffnerd/injury.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Injury do 2 | defstruct [ 3 | :game_status, 4 | :injury, 5 | :last_update, 6 | :notes, 7 | :player_id, 8 | :player_name, 9 | :position, 10 | :practice_status, 11 | :practice_status_id, 12 | :team, 13 | :week, 14 | ] 15 | 16 | @moduledoc """ 17 | Provides functions to work with Fantasy Football Nerd's Injury resources. 18 | 19 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#injuries 20 | """ 21 | 22 | @doc """ 23 | Convert raw api data to Player.Injury struct. 24 | """ 25 | def new(map) do 26 | %FFNerd.Injury{ 27 | game_status: map["gameStatus"], 28 | injury: map["injury"], 29 | last_update: map["lastUpdate"], 30 | notes: map["notes"], 31 | player_id: map["playerId"], 32 | player_name: map["playerName"], 33 | position: map["position"], 34 | practice_status: map["practiceStatus"], 35 | practice_status_id: map["practiceStatusId"] |> int_to_str, 36 | team: map["team"], 37 | week: map["week"], 38 | } 39 | end 40 | 41 | @doc """ 42 | Return a list of injury records. 43 | 44 | ## Examples 45 | 46 | FFNerd.Injury.list client 47 | 48 | """ 49 | def list(client) do 50 | {:Injuries, %FFNerd.URL{service: "injuries"}} 51 | |> FFNerd.get(client) 52 | |> Enum.map(fn{k, v} -> 53 | {k, Enum.map(v, &(new(&1)))} 54 | end) 55 | |> Enum.into(%{}) 56 | end 57 | 58 | @doc """ 59 | Return a list of injury records by week. 60 | 61 | ## Examples 62 | 63 | FFNerd.Injury.list 17, client 64 | 65 | """ 66 | def list(week, client) when is_integer(week) do 67 | {:Injuries, %FFNerd.URL{service: "injuries", path1: week}} 68 | |> FFNerd.get(client) 69 | |> Enum.map(&new/1) 70 | end 71 | 72 | @doc """ 73 | Return a list of current week injury records by team. 74 | 75 | ## Examples 76 | 77 | FFNerd.Injury.list "SEA", client 78 | 79 | """ 80 | def list(team, client) do 81 | {:Injuries, %FFNerd.URL{service: "injuries"}} 82 | |> FFNerd.get(client) 83 | |> Map.get(team) 84 | |> Enum.map(&new/1) 85 | end 86 | 87 | @doc """ 88 | Return a list of injury records by team and week. 89 | 90 | ## Examples 91 | 92 | FFNerd.Injury.list "SEA", 17, client 93 | 94 | """ 95 | def list(team, week, client) do 96 | {:Injuries, %FFNerd.URL{service: "injuries", path1: week}} 97 | |> FFNerd.get(client) 98 | |> Map.get(team) 99 | |> Enum.map(&new/1) 100 | end 101 | 102 | @doc """ 103 | Return a single injury record by player id and team code. 104 | 105 | ## Examples 106 | 107 | FFNerd.Injury.find 1465, "SEA", client 108 | 109 | """ 110 | def find(id, team, client) do 111 | list(team, client) |> Enum.find(&(&1.player_id == "#{id}")) 112 | end 113 | 114 | @doc """ 115 | Return a single injury record by player id, team code, and week. 116 | 117 | ## Examples 118 | 119 | FFNerd.Injury.find 1465, "SEA", 17, client 120 | 121 | """ 122 | def find(id, team, week, client) do 123 | list(team, week, client) |> Enum.find(&(&1.player_id == "#{id}")) 124 | end 125 | 126 | defp int_to_str(int) when is_integer(int), do: int |> Integer.to_string 127 | defp int_to_str(str) when is_binary(str) , do: str 128 | end 129 | -------------------------------------------------------------------------------- /lib/ffnerd/player.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Player do 2 | defstruct [:player_id, :star, :active, :jersey, :fname, :lname, :display_name, :team, :position, :height, :weight, :dob, :college, :twitter_id] 3 | use ExConstructor 4 | 5 | @moduledoc """ 6 | Provides functions to work with Fantasy Football Nerd's Players resources. 7 | 8 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#players 9 | """ 10 | 11 | @doc """ 12 | Return a list of all player records. 13 | 14 | ## Examples 15 | 16 | FFNerd.Player.list client 17 | 18 | """ 19 | def list(client) do 20 | {:Players, %FFNerd.URL{service: "players"}} 21 | |> FFNerd.get(client) 22 | |> Enum.map(&new/1) 23 | end 24 | 25 | @doc """ 26 | Return a list of player records by position code. 27 | 28 | ## Examples 29 | 30 | FFNerd.Player.list "QB", client 31 | 32 | """ 33 | def list(position, client) do 34 | {:Players, %FFNerd.URL{service: "players", path1: position}} 35 | |> FFNerd.get(client) 36 | |> Enum.map(&new/1) 37 | end 38 | 39 | @doc """ 40 | Return a single player record by player id or display name 41 | 42 | ## Examples 43 | 44 | FFNerd.Player.find 2, client 45 | FFNerd.Player.find "Russell Wilson", client 46 | 47 | """ 48 | def find(id, client) when is_integer(id) do 49 | client |> list |> Enum.find(&(&1.player_id == "#{id}")) 50 | end 51 | 52 | def find(name, client) do 53 | client |> list |> Enum.find(&(&1.display_name == name)) 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /lib/ffnerd/player/stats.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Player.Stats do 2 | defstruct [ 3 | :final_score, 4 | :fumbles, 5 | :fumbles_lost, 6 | :game_date, 7 | :game_played, 8 | :game_started, 9 | :interceptions, 10 | :opponent, 11 | :pass_attempts, 12 | :pass_completions, 13 | :pass_percentage, 14 | :pass_tds, 15 | :pass_yards, 16 | :pass_yards_average, 17 | :player_id, 18 | :qb_rating, 19 | :receptions, 20 | :rec_tds, 21 | :rec_yards, 22 | :rec_yards_average, 23 | :rec_yards_longest, 24 | :rush_attempts, 25 | :rush_tds, 26 | :rush_yards, 27 | :rush_yards_average, 28 | :rush_yards_longest, 29 | :sack_yards, 30 | :sacks, 31 | :week, 32 | :year, 33 | ] 34 | 35 | @moduledoc """ 36 | Provides functions to work with Fantasy Football Nerd's Player Stats resources. 37 | 38 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#player 39 | """ 40 | 41 | @doc """ 42 | Convert raw api data to Player.Stats struct. 43 | """ 44 | def new(map) do 45 | %FFNerd.Player.Stats{ 46 | final_score: map["finalScore"], 47 | fumbles: map["fumble"], 48 | fumbles_lost: map["fumbleLost"], 49 | game_date: map["gameDate"], 50 | game_played: map["gamePlayed"], 51 | game_started: map["gameStarted"], 52 | interceptions: map["interceptions"], 53 | opponent: map["opponent"], 54 | pass_attempts: map["passAttempts"], 55 | pass_completions: map["completions"], 56 | pass_percentage: map["percentage"], 57 | pass_tds: map["passTD"], 58 | pass_yards: map["passYards"], 59 | pass_yards_average: map["avgPassYards"], 60 | player_id: map["playerId"], 61 | qb_rating: map["QBRating"], 62 | receptions: map["receptions"], 63 | rec_tds: map["recTD"], 64 | rec_yards: map["recYards"], 65 | rec_yards_average: map["recAvg"], 66 | rush_attempts: map["rushAttempts"], 67 | rush_tds: map["rushTD"], 68 | rush_yards: map["rushYards"], 69 | rush_yards_average: map["rushAvg"], 70 | rush_yards_longest: map["longRun"], 71 | sack_yards: map["SackYards"], 72 | sacks: map["Sacks"], 73 | week: map["week"], 74 | year: map["year"], 75 | } 76 | end 77 | 78 | @doc """ 79 | Return player stats record by id or FFNerd.Player struct. 80 | 81 | ## Examples 82 | 83 | FFNerd.Player.Stats.find 2, client 84 | 85 | """ 86 | def find(%{player_id: id}, client) do 87 | find(id, client) 88 | end 89 | 90 | def find(id, client) do 91 | {:Stats, %FFNerd.URL{service: "player", path1: id}} 92 | |> FFNerd.get(client) 93 | |> Enum.map(fn{k, v} -> 94 | {k, Enum.map(v, fn{k2, v2} -> 95 | {k2, new(v2)} 96 | end) |> Enum.into(%{})} 97 | end) 98 | |> Enum.into(%{}) 99 | end 100 | 101 | @doc """ 102 | Return player stats record by id and year. 103 | 104 | ## Examples 105 | 106 | FFNerd.Player.Stats.find 2, 2009, client 107 | 108 | """ 109 | def find(id, year, client) do 110 | {:Stats, %FFNerd.URL{service: "player", path1: id}} 111 | |> FFNerd.get(client) 112 | |> Map.get("#{year}") 113 | |> Enum.map(fn{k, v} -> {k, new(v)} end) 114 | |> Enum.into(%{}) 115 | end 116 | 117 | @doc """ 118 | Return player stats record by id, year, and week. 119 | 120 | ## Examples 121 | 122 | FFNerd.Player.Stats.find 2, 2009, 17, client 123 | 124 | """ 125 | def find(id, year, week, client) do 126 | {:Stats, %FFNerd.URL{service: "player", path1: id}} 127 | |> FFNerd.get(client) 128 | |> Map.get("#{year}") 129 | |> Map.get("#{week}") 130 | |> new 131 | end 132 | end 133 | -------------------------------------------------------------------------------- /lib/ffnerd/player/video.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Player.Video do 2 | defstruct [ 3 | :video_title, 4 | :youtube_id, 5 | ] 6 | 7 | @moduledoc """ 8 | Provides functions to work with Fantasy Football Nerd's Player Videos resources. 9 | 10 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#player 11 | """ 12 | 13 | @doc """ 14 | Convert raw api data to Player.Video struct. 15 | """ 16 | def new(map) do 17 | %FFNerd.Player.Video{ 18 | video_title: map["videoTitle"], 19 | youtube_id: map["youTubeId"], 20 | } 21 | end 22 | 23 | @doc """ 24 | Return a list of player video records by player id. 25 | 26 | ## Examples 27 | 28 | FFNerd.Player.Video.list 14, client 29 | 30 | """ 31 | def list(id, client) do 32 | {:Videos, %FFNerd.URL{service: "player", path1: id}} 33 | |> FFNerd.get(client) 34 | |> Enum.map(&(new(&1))) 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/ffnerd/schedule.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Schedule do 2 | alias FFNerd.Game 3 | 4 | @moduledoc """ 5 | Provides functions to work with Fantasy Football Nerd's NFL Schedule resources. 6 | 7 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#schedule 8 | """ 9 | 10 | @doc """ 11 | Return the associated current week. 12 | 13 | ## Examples 14 | 15 | FFNerd.Schedule.current_week client 16 | 17 | """ 18 | def current_week(client) do 19 | FFNerd.get({:currentWeek, %FFNerd.URL{service: "schedule"}}, client) 20 | end 21 | 22 | @doc """ 23 | Return a list of all game records. 24 | 25 | ## Examples 26 | 27 | FFNerd.Schedule.list client 28 | 29 | """ 30 | def list(client) do 31 | {:Schedule, %FFNerd.URL{service: "schedule"}} 32 | |> FFNerd.get(client) 33 | |> Enum.map(&Game.new/1) 34 | end 35 | 36 | @doc """ 37 | Return a list of game records by team code. 38 | 39 | ## Examples 40 | 41 | FFNerd.Schedule.list client 42 | 43 | """ 44 | def list(team, client) do 45 | client 46 | |> list 47 | |> Enum.filter(fn(x) -> 48 | x.home_team == "#{team}" || 49 | x.away_team == "#{team}" 50 | end) 51 | end 52 | 53 | @doc """ 54 | Return a single game record by game id. 55 | 56 | ## Examples 57 | 58 | FFNerd.Schedule.list client 59 | 60 | """ 61 | def find(id, client) do 62 | client |> list |> Enum.find(&(&1.game_id == "#{id}")) 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /lib/ffnerd/team.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Team do 2 | defstruct [:code, :full_name, :short_name] 3 | use ExConstructor 4 | 5 | @moduledoc """ 6 | Provides functions to work with Fantasy Football Nerd's Bye Week resources. 7 | 8 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#teams 9 | """ 10 | 11 | @doc """ 12 | Return a list of all team records. 13 | 14 | ## Examples 15 | 16 | FFNerd.Team.list client 17 | 18 | """ 19 | def list(client) do 20 | {:NFLTeams, %FFNerd.URL{service: "nfl-teams"}} 21 | |> FFNerd.get(client) 22 | |> Enum.map(&new/1) 23 | end 24 | 25 | @doc """ 26 | Return a single team record by team code. 27 | 28 | ## Examples 29 | 30 | FFNerd.Team.find "SEA", client 31 | 32 | """ 33 | def find(team, client) do 34 | {:NFLTeams, %FFNerd.URL{service: "nfl-teams"}} 35 | |> FFNerd.get(client) 36 | |> Stream.map(&new/1) 37 | |> Enum.find(&(&1.code == team)) 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /lib/ffnerd/url.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.URL do 2 | defstruct [:endpoint, :service, :format, :api_key, :path1, :path2, :path3] 3 | end 4 | -------------------------------------------------------------------------------- /lib/ffnerd/weather.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Weather do 2 | defstruct [ 3 | :away_team, 4 | :dome_img, 5 | :forecast, 6 | :game_date, 7 | :game_id, 8 | :game_time_et, 9 | :game_week, 10 | :geo_lat, 11 | :geo_long, 12 | :high, 13 | :home_team, 14 | :is_dome, 15 | :large_img, 16 | :low, 17 | :medium_img, 18 | :small_img, 19 | :stadium, 20 | :tv_station, 21 | :wind_chill, 22 | :wind_speed, 23 | ] 24 | 25 | @moduledoc """ 26 | Provides functions to work with Fantasy Football Nerd's Weather Forecasts resources. 27 | 28 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#weather 29 | """ 30 | 31 | @doc """ 32 | Convert raw api data to Weather struct. 33 | """ 34 | def new(map) do 35 | %FFNerd.Weather{ 36 | away_team: map["awayTeam"], 37 | dome_img: map["domeImg"], 38 | forecast: map["forecast"], 39 | game_date: map["gameDate"], 40 | game_id: map["gameId"], 41 | game_time_et: map["gameTimeET"], 42 | game_week: map["gameWeek"], 43 | geo_lat: map["geoLat"], 44 | geo_long: map["geoLong"], 45 | high: map["high"], 46 | home_team: map["homeTeam"], 47 | is_dome: map["isDome"], 48 | large_img: map["largeImg"], 49 | low: map["low"], 50 | medium_img: map["mediumImg"], 51 | small_img: map["smallImg"], 52 | stadium: map["stadium"], 53 | tv_station: map["tvStation"], 54 | wind_chill: map["windChill"], 55 | wind_speed: map["windSpeed"] 56 | } 57 | end 58 | 59 | @doc """ 60 | Return the associated current date. 61 | 62 | ## Examples 63 | 64 | FFNerd.Schedule.today client 65 | 66 | """ 67 | def current_date(client) do 68 | FFNerd.get({:Today, %FFNerd.URL{service: "weather"}}, client) 69 | end 70 | 71 | @doc """ 72 | Return the associated current week. 73 | 74 | ## Examples 75 | 76 | FFNerd.Schedule.week client 77 | 78 | """ 79 | def current_week(client) do 80 | FFNerd.get({:Week, %FFNerd.URL{service: "weather"}}, client) 81 | end 82 | 83 | @doc """ 84 | Return a list of all weather forecast records. 85 | 86 | ## Examples 87 | 88 | FFNerd.Schedule.list client 89 | 90 | """ 91 | def list(client) do 92 | {:Games, %FFNerd.URL{service: "weather"}} 93 | |> FFNerd.get(client) 94 | |> Enum.map(fn{_k, v} -> new(v) end) 95 | end 96 | 97 | @doc """ 98 | Return a single weather forecast record by game id. 99 | 100 | ## Examples 101 | 102 | FFNerd.Weather.find 2, client 103 | 104 | """ 105 | def find(id, client) when is_integer(id) do 106 | client |> list |> Enum.find(&(&1.game_id == "#{id}")) 107 | end 108 | 109 | @doc """ 110 | Return a single weather forecast record by team code. 111 | 112 | ## Examples 113 | 114 | FFNerd.Weather.find "SEA", client 115 | 116 | """ 117 | def find(team, client) do 118 | client 119 | |> list 120 | |> Enum.find(fn(x) -> 121 | x.home_team == "#{team}" || 122 | x.away_team == "#{team}" 123 | end) 124 | end 125 | end 126 | -------------------------------------------------------------------------------- /lib/ffnerd/weekly_idp_ranking.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.WeeklyIDPRanking do 2 | defstruct [:player, :position, :rank, :team] 3 | use ExConstructor 4 | 5 | @moduledoc """ 6 | Provides functions to work with Fantasy Football Nerd's Weekly Ranking resources. 7 | 8 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#weekly-idp 9 | """ 10 | 11 | @doc """ 12 | Return a list of weekly idp ranking records. 13 | 14 | ## Examples 15 | 16 | FFNerd.WeeklyIDPRanking.list client 17 | 18 | FFNerd.WeeklyIDPRankingDraftRanking.list :ppr, client 19 | 20 | """ 21 | def list(client) do 22 | {:rankings, %FFNerd.URL{service: "weekly-idp"}} 23 | |> FFNerd.get(client) 24 | |> Enum.map(&new/1) 25 | end 26 | 27 | 28 | @doc """ 29 | Return a list of weekly idp ranking records by position using the current week. 30 | 31 | ## Examples 32 | 33 | FFNerd.WeeklyIDPRanking.list "DE", client 34 | 35 | """ 36 | def list(position, client) do 37 | list(client) |> Enum.filter(&(&1.position == position)) 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /lib/ffnerd/weekly_projection.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.WeeklyProjection do 2 | defstruct [ 3 | :def_fumbles_forced, 4 | :def_fumbles_recovered, 5 | :def_interceptions, 6 | :def_points_allowed, 7 | :def_return_tds, 8 | :def_sacks, 9 | :def_safeties, 10 | :def_tds, 11 | :def_yards_allowed, 12 | :display_name, 13 | :extra_points, 14 | :field_goals, 15 | :field_goal_attempts, 16 | :fumbles_lost, 17 | :pass_attempts, 18 | :pass_completions, 19 | :pass_interceptions, 20 | :pass_tds, 21 | :pass_yards, 22 | :player_id, 23 | :position, 24 | :rec_tds, 25 | :rec_yards, 26 | :receptions, 27 | :rush_attempts, 28 | :rush_tds, 29 | :rush_yards, 30 | :team, 31 | :week, 32 | ] 33 | 34 | @moduledoc """ 35 | Provides functions to work with Fantasy Football Nerd's WeeklyProjection resources. 36 | 37 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#weekly-projections 38 | """ 39 | 40 | @doc """ 41 | Convert raw api data to WeeklyProjection struct. 42 | """ 43 | def new(map) do 44 | %FFNerd.WeeklyProjection{ 45 | def_fumbles_forced: map["defFF"], 46 | def_fumbles_recovered: map["defFR"], 47 | def_interceptions: map["defInt"], 48 | def_points_allowed: map["defPA"], 49 | def_return_tds: map["defRetTD"], 50 | def_sacks: map["defSack"], 51 | def_safeties: map["defSafety"], 52 | def_tds: map["defTD"], 53 | def_yards_allowed: map["defYdsAllowed"], 54 | display_name: map["displayName"], 55 | extra_points: map["xp"], 56 | field_goals: map["fg"], 57 | field_goal_attempts: map["fgAtt"], 58 | fumbles_lost: map["fumblesLost"], 59 | pass_attempts: map["passAtt"], 60 | pass_completions: map["passCmp"], 61 | pass_interceptions: map["passInt"], 62 | pass_tds: map["passTD"], 63 | pass_yards: map["passYds"], 64 | player_id: map["playerId"], 65 | position: map["position"], 66 | rec_tds: map["recTD"], 67 | rec_yards: map["recYds"], 68 | receptions: map["receptions"], 69 | rush_attempts: map["rushAtt"], 70 | rush_tds: map["rushTD"], 71 | rush_yards: map["rushYds"], 72 | team: map["team"], 73 | week: map["week"] 74 | } 75 | end 76 | 77 | @doc """ 78 | Return a list of weekly projection records by position. 79 | 80 | ## Examples 81 | 82 | FFNerd.WeeklyProjection.list "QB", client 83 | 84 | FFNerd.WeeklyProjection.list :ppr, "QB", client 85 | 86 | """ 87 | def list(position, client) do 88 | {:Projections, %FFNerd.URL{service: "weekly-projections", path1: position}} 89 | |> FFNerd.get(client) 90 | |> Enum.map(&new/1) 91 | end 92 | 93 | @doc """ 94 | Return a list of weekly projection records by position and week. 95 | 96 | ## Examples 97 | 98 | FFNerd.WeeklyProjection.list "QB", client 99 | 100 | FFNerd.WeeklyProjection.list :ppr, "QB", client 101 | 102 | """ 103 | def list(position, week, client) do 104 | {:Projections, %FFNerd.URL{service: "weekly-projections", path1: position, path2: week}} 105 | |> FFNerd.get(client) 106 | |> Enum.map(&new/1) 107 | end 108 | 109 | @doc """ 110 | Return a single weekly ranking projection by person id and position. 111 | 112 | ## Examples 113 | 114 | FFNerd.WeeklyProjection.find 259, client 115 | 116 | FFNerd.WeeklyProjection.find :ppr, 259, client 117 | 118 | """ 119 | def find(id, position, client) do 120 | list(position, client) |> Enum.find(&(&1.player_id == "#{id}")) 121 | end 122 | 123 | @doc """ 124 | Return a single weekly ranking projection by person id, position, and week. 125 | 126 | ## Examples 127 | 128 | FFNerd.WeeklyProjection.find 259, client 129 | 130 | FFNerd.WeeklyProjection.find :ppr, 259, client 131 | 132 | """ 133 | def find(id, position, week, client) do 134 | list(position, week, client) |> Enum.find(&(&1.player_id == "#{id}")) 135 | end 136 | end 137 | -------------------------------------------------------------------------------- /lib/ffnerd/weekly_ranking.ex: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.WeeklyRanking do 2 | defstruct [:game_status, :injury, :last_update, :name, :player_id, :position, :ppr, :ppr_low, :ppr_high, :practice_status, :standard, :standard_low, :standard_high, :team, :week] 3 | use ExConstructor 4 | 5 | @moduledoc """ 6 | Provides functions to work with Fantasy Football Nerd's Weekly Ranking resources. 7 | 8 | More info at: http://www.fantasyfootballnerd.com/fantasy-football-api#weekly-rankings 9 | """ 10 | 11 | @doc """ 12 | Return a list of weekly ranking records by position using the current week. 13 | 14 | ## Examples 15 | 16 | FFNerd.WeeklyRanking.list "QB", client 17 | 18 | """ 19 | def list(position, client) do 20 | {:Rankings, %FFNerd.URL{service: "weekly-rankings", path1: position}} 21 | |> FFNerd.get(client) 22 | |> Enum.map(&new/1) 23 | end 24 | 25 | @doc """ 26 | Return a list of weekly ranking records by position and week. 27 | 28 | ## Examples 29 | 30 | FFNerd.WeeklyRanking.list "QB", client 31 | 32 | """ 33 | def list(position, week, client) do 34 | {:Rankings, %FFNerd.URL{service: "weekly-rankings", path1: position, path2: week}} 35 | |> FFNerd.get(client) 36 | |> Enum.map(&new/1) 37 | end 38 | 39 | @doc """ 40 | Return a single weekly ranking record by person id. 41 | 42 | ## Examples 43 | 44 | FFNerd.WeeklyRanking.find 259, client 45 | 46 | """ 47 | def find(id, position, client) do 48 | list(position, client) |> Enum.find(&(&1.player_id == "#{id}")) 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /mix.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Mixfile do 2 | use Mix.Project 3 | 4 | def project do 5 | [app: :ffnerd, 6 | version: "0.2.1", 7 | elixir: "~> 1.5", 8 | build_embedded: Mix.env == :prod, 9 | start_permanent: Mix.env == :prod, 10 | description: description(), 11 | package: package(), 12 | deps: deps()] 13 | end 14 | 15 | def application do 16 | [applications: [ :logger, :httpoison, :exconstructor ]] 17 | end 18 | 19 | defp deps do 20 | [ 21 | {:credo, "~> 0.8", only: [:dev, :test], runtime: false}, 22 | {:earmark, "~> 1.2.2", only: :dev}, 23 | {:ex_doc, "~> 0.16", only: :dev, runtime: false}, 24 | {:exconstructor, "~> 1.1.0"}, 25 | {:exvcr, "~> 0.8", only: :test}, 26 | {:httpoison, "~> 0.13"}, 27 | {:meck, "~> 0.8.4", only: :test}, 28 | {:mix_test_watch, "~> 0.3", only: :dev, runtime: false}, 29 | {:poison, "~> 3.1"}, 30 | ] 31 | end 32 | 33 | defp description do 34 | """ 35 | An Elixir wrapper for the Fantasy Football Nerd API (http://www.fantasyfootballnerd.com/fantasy-football-api) 36 | """ 37 | end 38 | 39 | defp package do 40 | [ 41 | name: :ffnerd, 42 | maintainers: ["Jesse J. Anderson"], 43 | licenses: ["MIT"], 44 | links: %{"GitHub" => "https://github.com/jessejanderson/ffnerd-api-elixir"} 45 | ] 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /mix.lock: -------------------------------------------------------------------------------- 1 | %{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, 2 | "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"}, 3 | "credo": {:hex, :credo, "0.8.6", "335f723772d35da499b5ebfdaf6b426bfb73590b6fcbc8908d476b75f8cbca3f", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}], "hexpm"}, 4 | "earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], [], "hexpm"}, 5 | "ex_doc": {:hex, :ex_doc, "0.16.3", "cd2a4cfe5d26e37502d3ec776702c72efa1adfa24ed9ce723bb565f4c30bd31a", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}, 6 | "exactor": {:hex, :exactor, "2.2.3", "a6972f43bb6160afeb73e1d8ab45ba604cd0ac8b5244c557093f6e92ce582786", [], [], "hexpm"}, 7 | "exconstructor": {:hex, :exconstructor, "1.1.0", "272623a7b203cb2901c20cbb92c5c3ab103cc0087ff7c881979e046043346752", [:mix], [], "hexpm"}, 8 | "exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"}, 9 | "exvcr": {:hex, :exvcr, "0.8.12", "1ec5148708fedb9b4d0d32ca74bf8722de1854b5a666b3f8f9ba6fdee8353881", [], [{:exactor, "~> 2.2", [hex: :exactor, repo: "hexpm", optional: false]}, {:exjsx, "~> 4.0", [hex: :exjsx, repo: "hexpm", optional: false]}, {:httpoison, "~> 0.11", [hex: :httpoison, repo: "hexpm", optional: true]}, {:httpotion, "~> 3.0", [hex: :httpotion, repo: "hexpm", optional: true]}, {:ibrowse, "~> 4.2.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:meck, "~> 0.8.3", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"}, 10 | "fs": {:hex, :fs, "0.9.2", "ed17036c26c3f70ac49781ed9220a50c36775c6ca2cf8182d123b6566e49ec59", [:rebar], []}, 11 | "hackney": {:hex, :hackney, "1.9.0", "51c506afc0a365868469dcfc79a9d0b94d896ec741cfd5bd338f49a5ec515bfe", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"}, 12 | "httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, 13 | "idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, 14 | "jsx": {:hex, :jsx, "2.8.2", "7acc7d785b5abe8a6e9adbde926a24e481f29956dd8b4df49e3e4e7bcc92a018", [], [], "hexpm"}, 15 | "meck": {:hex, :meck, "0.8.8", "eeb3efe811d4346e1a7f65b2738abc2ad73cbe1a2c91b5dd909bac2ea0414fa6", [], [], "hexpm"}, 16 | "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []}, 17 | "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []}, 18 | "mix_test_watch": {:hex, :mix_test_watch, "0.5.0", "2c322d119a4795c3431380fca2bca5afa4dc07324bd3c0b9f6b2efbdd99f5ed3", [], [{:fs, "~> 0.9.1", [hex: :fs, repo: "hexpm", optional: false]}], "hexpm"}, 19 | "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [], [], "hexpm"}, 20 | "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"}, 21 | "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [], [], "hexpm"}} 22 | -------------------------------------------------------------------------------- /test/ffnerd/auction_value_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.AuctionValueTest do 2 | use ExUnit.Case 3 | import FFNerd.AuctionValue 4 | 5 | doctest FFNerd.AuctionValue 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of all auction value records." do 14 | assert [%FFNerd.AuctionValue{} | _rest] = list(@client) 15 | end 16 | 17 | test "Return a list of all auction value records by position." do 18 | assert [%FFNerd.AuctionValue{position: "QB"} | _rest] = list("QB", @client) 19 | end 20 | 21 | test "Return a single auction value record by person id." do 22 | assert %FFNerd.AuctionValue{} = find(230, @client) 23 | end 24 | 25 | test "Return all details from an auction value record." do 26 | player = find(230, @client) 27 | 28 | assert "57" = player.avg_price 29 | assert "Marshawn Lynch" = player.display_name 30 | assert "58" = player.max_price 31 | assert "56" = player.min_price 32 | assert "230" = player.player_id 33 | assert "RB" = player.position 34 | assert "0" = player.ppr 35 | assert "SEA" = player.team 36 | end 37 | 38 | # Test account does not work with PPR tests 39 | 40 | # test "Return a list of all ppr auction value records." do 41 | # assert [%FFNerd.AuctionValue{ppr: "1"} | _rest] = list(:ppr, @client) 42 | # end 43 | 44 | # test "Return a list of all ppr auction value records by position." do 45 | # assert [%FFNerd.AuctionValue{position: "QB", ppr: "1"} | _rest] = list(:ppr, "QB", @client) 46 | # end 47 | 48 | # test "Return a single ppr auction value record by person id." do 49 | # assert %FFNerd.AuctionValue{ppr: "1"} = find(:ppr, 259, @client) 50 | # end 51 | end 52 | -------------------------------------------------------------------------------- /test/ffnerd/bye_week_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.ByeWeekTest do 2 | use ExUnit.Case 3 | import FFNerd.ByeWeek 4 | 5 | doctest FFNerd.ByeWeek 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of bye week records." do 14 | assert [%FFNerd.ByeWeek{} | _rest] = list(@client) 15 | end 16 | 17 | test "Return a list of bye week records by week number." do 18 | assert [%FFNerd.ByeWeek{bye_week: "4"} | _rest] = list(4, @client) 19 | end 20 | 21 | test "Return a single bye week record by team code." do 22 | assert %FFNerd.ByeWeek{team: "SEA"} = find("SEA", @client) 23 | end 24 | 25 | test "Return all details from a bye week record." do 26 | bye = find("SEA", @client) 27 | 28 | assert "12" = bye.bye_week 29 | assert "Seattle Seahawks" = bye.display_name 30 | assert "SEA" = bye.team 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /test/ffnerd/client_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.ClientTest do 2 | use ExUnit.Case 3 | import FFNerd.Client 4 | 5 | doctest FFNerd.Client 6 | 7 | test "default endpoint" do 8 | client = new("") 9 | assert client.endpoint == "https://www.fantasyfootballnerd.com" 10 | end 11 | 12 | test "custom endpoint" do 13 | client = new("", "http://www.example.com") 14 | assert client.endpoint == "http://www.example.com" 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /test/ffnerd/defense_ranking_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DefenseRankingTest do 2 | use ExUnit.Case 3 | import FFNerd.DefenseRanking 4 | 5 | doctest FFNerd.DefenseRanking 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of all defense ranking records." do 14 | assert [%FFNerd.DefenseRanking{} | _rest] = list(@client) 15 | end 16 | 17 | test "Return the details from a defense ranking record." do 18 | defense_ranking = find("SEA", @client) 19 | 20 | assert "173.8" = defense_ranking.pass_yards_per_game 21 | assert "1" = defense_ranking.pass_yards_per_game_rank 22 | assert "14.8" = defense_ranking.points_per_game 23 | assert "2" = defense_ranking.points_per_game_rank 24 | assert "107.5" = defense_ranking.rush_yards_per_game 25 | assert "12" = defense_ranking.rush_yards_per_game_rank 26 | assert "SEA" = defense_ranking.team 27 | assert "Seattle Seahawks" = defense_ranking.team_name 28 | assert "281.3" = defense_ranking.total_yards_per_game 29 | assert "1" = defense_ranking.total_yards_per_game_rank 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /test/ffnerd/depth_chart_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DepthChartTest do 2 | use ExUnit.Case 3 | import FFNerd.DepthChart 4 | alias FFNerd.DepthChart 5 | alias FFNerd.DepthChart.Player 6 | 7 | doctest FFNerd.DepthChart 8 | 9 | @client FFNerd.Client.new("test") 10 | 11 | setup_all do 12 | HTTPoison.start 13 | end 14 | 15 | test "Return all depth charts" do 16 | depth_charts = list(@client) 17 | assert %{"SEA" => %DepthChart{qb: [%Player{player_name: "Russell Wilson"} | _]}} = depth_charts 18 | end 19 | 20 | test "Return one team's depth chart by team code" do 21 | team = find("SEA", @client) 22 | assert %DepthChart{qb: [%Player{player_name: "Russell Wilson"} | _]} = team 23 | end 24 | 25 | test "Return one team's position depth chart by team code and position" do 26 | team_qbs = find("SEA", "QB", @client) 27 | assert [%Player{player_name: "Russell Wilson"} | _] = team_qbs 28 | end 29 | 30 | test "Return depth chart player by team code, position, and depth" do 31 | player = find("SEA", "WR1", 1, @client) 32 | assert %Player{player_name: "Doug Baldwin"} = player 33 | 34 | assert "1" = player.depth 35 | assert "1549" = player.player_id 36 | assert "Doug Baldwin" = player.player_name 37 | assert "WR1" = player.position 38 | assert "SEA" = player.team 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /test/ffnerd/draft_projection_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DraftProjectionTest do 2 | use ExUnit.Case 3 | import FFNerd.DraftProjection 4 | 5 | doctest FFNerd.DraftProjection 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of all draft projection records by position." do 14 | assert [%FFNerd.DraftProjection{} | _rest] = list("QB", @client) 15 | end 16 | 17 | test "Return a single draft projection record by person id." do 18 | assert %FFNerd.DraftProjection{} = find(1847, "QB", @client) 19 | end 20 | 21 | test "Return all projections from a QB draft projection record." do 22 | draft_projections = find(14, "QB", @client) 23 | 24 | assert "Drew Brees" = draft_projections.display_name 25 | assert "335" = draft_projections.fantasy_points 26 | assert "640" = draft_projections.pass_attempts 27 | assert "422" = draft_projections.pass_completions 28 | assert "17" = draft_projections.pass_interceptions 29 | assert "40" = draft_projections.pass_tds 30 | assert "4992" = draft_projections.pass_yards 31 | assert "14" = draft_projections.player_id 32 | assert "1" = draft_projections.rush_tds 33 | assert "28" = draft_projections.rush_yards 34 | assert "NO" = draft_projections.team 35 | end 36 | 37 | test "Return all projections from a RB draft projection record." do 38 | draft_projections = find(259, "RB", @client) 39 | 40 | assert "Adrian Peterson" = draft_projections.display_name 41 | assert "273" = draft_projections.fantasy_points 42 | assert "259" = draft_projections.player_id 43 | assert "39" = draft_projections.receptions 44 | assert "1" = draft_projections.rec_tds 45 | assert "318" = draft_projections.rec_yards 46 | assert "342" = draft_projections.rush_attempts 47 | assert "12" = draft_projections.rush_tds 48 | assert "1674" = draft_projections.rush_yards 49 | assert "MIN" = draft_projections.team 50 | end 51 | 52 | test "Return all projections from a WR draft projection record." do 53 | draft_projections = find(454, "WR", @client) 54 | 55 | assert "Calvin Johnson" = draft_projections.display_name 56 | assert "212" = draft_projections.fantasy_points 57 | assert "454" = draft_projections.player_id 58 | assert "98" = draft_projections.receptions 59 | assert "11" = draft_projections.rec_tds 60 | assert "1461" = draft_projections.rec_yards 61 | assert "0" = draft_projections.rush_attempts 62 | assert "0" = draft_projections.rush_tds 63 | assert "0" = draft_projections.rush_yards 64 | assert "DET" = draft_projections.team 65 | end 66 | 67 | test "Return all projections from a TE draft projection record." do 68 | draft_projections = find(1187, "TE", @client) 69 | 70 | assert "Jimmy Graham" = draft_projections.display_name 71 | assert "172" = draft_projections.fantasy_points 72 | assert "1187" = draft_projections.player_id 73 | assert "91" = draft_projections.receptions 74 | assert "10" = draft_projections.rec_tds 75 | assert "1122" = draft_projections.rec_yards 76 | assert "0" = draft_projections.rush_attempts 77 | assert "0" = draft_projections.rush_tds 78 | assert "0" = draft_projections.rush_yards 79 | assert "NO" = draft_projections.team 80 | end 81 | 82 | test "Return all projections from a K draft projection record." do 83 | draft_projections = find(743, "K", @client) 84 | 85 | assert "Matt Bryant" = draft_projections.display_name 86 | assert "134" = draft_projections.fantasy_points 87 | assert "47" = draft_projections.extra_points 88 | assert "29" = draft_projections.field_goals 89 | assert "743" = draft_projections.player_id 90 | assert "ATL" = draft_projections.team 91 | end 92 | 93 | test "Return all projections from a DEF draft projection record." do 94 | draft_projections = find(1063, "DEF", @client) 95 | 96 | assert "14" = draft_projections.def_fumbles_recovered 97 | assert "142" = draft_projections.fantasy_points 98 | assert "21" = draft_projections.def_interceptions 99 | assert "1" = draft_projections.def_return_tds 100 | assert "48" = draft_projections.def_sacks 101 | assert "Houston Texans" = draft_projections.display_name 102 | assert "1063" = draft_projections.player_id 103 | assert "HOU" = draft_projections.team 104 | end 105 | end 106 | -------------------------------------------------------------------------------- /test/ffnerd/draft_ranking_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.DraftRankingTest do 2 | use ExUnit.Case 3 | import FFNerd.DraftRanking 4 | 5 | doctest FFNerd.DraftRanking 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of all draft ranking records." do 14 | assert [%FFNerd.DraftRanking{} | _rest] = list(@client) 15 | end 16 | 17 | test "Return a list of all draft ranking records by position." do 18 | assert [%FFNerd.DraftRanking{position: "QB"} | _rest] = list("QB", @client) 19 | end 20 | 21 | test "Return a single draft ranking record by person id." do 22 | assert %FFNerd.DraftRanking{} = find(259, @client) 23 | end 24 | 25 | test "Return the avg price from an draft ranking record." do 26 | draft_rankings = find(259, @client) 27 | assert "1.826" = draft_rankings.nerd_rank 28 | end 29 | 30 | test "Return a list of all ppr draft ranking records." do 31 | assert [%FFNerd.DraftRanking{ppr: "1"} | _rest] = list(:ppr, @client) 32 | end 33 | 34 | test "Return a list of all ppr draft ranking records by position." do 35 | assert [%FFNerd.DraftRanking{position: "QB", ppr: "1"} | _rest] = list(:ppr, "QB", @client) 36 | end 37 | 38 | test "Return a single ppr draft ranking record by person id." do 39 | assert %FFNerd.DraftRanking{ppr: "1"} = find(:ppr, 259, @client) 40 | end 41 | 42 | test "Return the details from a draft ranking record." do 43 | draft_ranking = find(:ppr, 1446, @client) 44 | 45 | assert "6" = draft_ranking.bye_week 46 | assert "Julio Jones" = draft_ranking.display_name 47 | assert "Julio" = draft_ranking.fname 48 | assert "Jones" = draft_ranking.lname 49 | assert "19.617" = draft_ranking.nerd_rank 50 | assert "15" = draft_ranking.overall_rank 51 | assert "1446" = draft_ranking.player_id 52 | assert "WR" = draft_ranking.position 53 | assert "6" = draft_ranking.position_rank 54 | assert "1" = draft_ranking.ppr 55 | assert "ATL" = draft_ranking.team 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /test/ffnerd/expert_pick/game_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.ExpertPick.GameTest do 2 | use ExUnit.Case 3 | import FFNerd.ExpertPick.Game 4 | 5 | doctest FFNerd.ExpertPick.Game 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return all ExpertPick games for current week." do 14 | game = list(@client) |> List.first 15 | assert "2015-10-01" = game.game_date 16 | end 17 | 18 | test "Return one ExpertPick game for current week by game id." do 19 | game = find(49, @client) 20 | 21 | assert "BAL" = game.away_team 22 | assert %{ "wins" => 0, "losses" => 3 } = game.away_team_record 23 | assert %{ "BAL" => 24, "PIT" => 18 } = game.consensus_count 24 | assert "BAL" = game.consensus_pick 25 | assert "2015-10-01" = game.game_date 26 | assert "8:25 PM" = game.game_time_et 27 | assert "PIT" = game.home_team 28 | assert %{ "wins" => 2, "losses" => 1 } = game.home_team_record 29 | assert "CBS" = game.tv_station 30 | assert "BAL" = game.winner 31 | assert [%FFNerd.ExpertPick{} | _] = game.picks 32 | assert "49" = game.game_id 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /test/ffnerd/expert_pick_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.ExpertPickTest do 2 | use ExUnit.Case 3 | import FFNerd.ExpertPick 4 | 5 | doctest FFNerd.ExpertPick 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return all expert picks for current week by game id." do 14 | picks = list(49, @client) 15 | expert = picks |> List.first 16 | assert "Adam Meyer" = expert.expert_name 17 | end 18 | 19 | test "Return one expert's picks for current week by game id and expert name." do 20 | expert = find("Adam Meyer", 49, @client) 21 | 22 | assert "1" = expert.correct 23 | assert "FOX Sports" = expert.expert_company 24 | assert "Adam Meyer" = expert.expert_name 25 | assert "35" = expert.expert_season_correct 26 | assert "BAL" = expert.game_pick 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /test/ffnerd/game_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.GameTest do 2 | use ExUnit.Case 3 | import FFNerd.Game 4 | 5 | doctest FFNerd.Game 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "get list of games" do 14 | assert [%{game_id: "1"} | _rest] = list(@client) 15 | end 16 | 17 | test "get a game by id" do 18 | assert %FFNerd.Game{game_id: "2"} = find(2, @client) 19 | end 20 | 21 | test "Return all details from a game record." do 22 | game = find(2, @client) 23 | 24 | assert "NE" = game.away_team 25 | assert "2013-09-08" = game.game_date 26 | assert "2" = game.game_id 27 | assert "1:00 PM" = game.game_time_et 28 | assert "1" = game.game_week 29 | assert "BUF" = game.home_team 30 | assert "CBS" = game.tv_station 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /test/ffnerd/inactive_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.InactiveTest do 2 | use ExUnit.Case 3 | import FFNerd.Inactive 4 | 5 | doctest FFNerd.Inactive 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return all inactives for current week" do 14 | inactives = list(@client) |> List.first 15 | assert %FFNerd.Inactive{display_name: "Andre Brown"} = inactives 16 | end 17 | 18 | test "Return all inactives by week" do 19 | inactives = list(17, @client) |> List.first 20 | assert %FFNerd.Inactive{display_name: "Adrian Peterson", week: "17"} = inactives 21 | end 22 | 23 | test "Return one inactive record by player id." do 24 | inactive = find(1465, @client) 25 | 26 | assert "Rob Housler" = inactive.display_name 27 | assert "1465" = inactive.player_id 28 | assert "TE" = inactive.position 29 | assert "ARI" = inactive.team 30 | assert "1" = inactive.week 31 | assert "2013" = inactive.year 32 | end 33 | 34 | test "Return one inactive record by player id and week" do 35 | inactive = find(259, 17, @client) 36 | assert %FFNerd.Inactive{display_name: "Adrian Peterson", week: "17"} = inactive 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /test/ffnerd/injury_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.InjuryTest do 2 | use ExUnit.Case 3 | import FFNerd.Injury 4 | 5 | doctest FFNerd.Injury 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return all injuries for current week" do 14 | injury = list(@client)["ARI"] |> List.first 15 | assert %FFNerd.Injury{} = injury 16 | end 17 | 18 | test "Return all team injuries by team code." do 19 | assert [%FFNerd.Injury{team: "ARI"} | _rest] = list("ARI", @client) 20 | end 21 | 22 | # NOTE: Tests with specified weeks are disabled due to missing test data from FFNerd. 23 | 24 | # test "Return all injuries by week" do 25 | # injury = list(17, @client)["ARI"] |> List.first 26 | # assert %FFNerd.Injury{week: "17"} = injury 27 | # end 28 | 29 | # test "Return all team injuries by team code and week." do 30 | # injuries = list("ARI", 17, @client) 31 | # assert [%FFNerd.Injury{team: "ARI", week: "17"} | _rest] = injuries 32 | # end 33 | 34 | test "Return one player's injuries by player id and team code." do 35 | assert %FFNerd.Injury{team: "ARI", player_id: "1465"} = find(1465, "ARI", @client) 36 | end 37 | 38 | test "Return one player's injuries by player id, team code, and week." do 39 | assert %FFNerd.Injury{team: "ARI", player_id: "1465", week: "17"} = find(1465, "ARI", 17, @client) 40 | end 41 | 42 | test "Return injuries from a player injury record." do 43 | player_injuries = find(1465, "ARI", @client) 44 | 45 | assert "Out" = player_injuries.game_status 46 | assert "Ankle" = player_injuries.injury 47 | assert "2013-09-09" = player_injuries.last_update 48 | assert "Missed Week 1 at St. Louis" = player_injuries.notes 49 | assert "1465" = player_injuries.player_id 50 | assert "Rob Housler" = player_injuries.player_name 51 | assert "TE" = player_injuries.position 52 | assert "Did not practice" = player_injuries.practice_status 53 | assert "1" = player_injuries.practice_status_id 54 | assert "ARI" = player_injuries.team 55 | assert "1" = player_injuries.week 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /test/ffnerd/player/stats_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Player.StatsTest do 2 | use ExUnit.Case 3 | import FFNerd.Player.Stats 4 | 5 | doctest FFNerd.Player.Stats 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return all player stats by %FFNerd.Player{} with player id." do 14 | player = find(%FFNerd.Player{player_id: 2}, @client) 15 | assert "1" = player["2007"]["1"].interceptions 16 | end 17 | 18 | test "Return all player stats by player id." do 19 | player = find(2, @client) 20 | assert "1" = player["2007"]["1"].interceptions 21 | end 22 | 23 | test "Return one year's player stats by player id and year." do 24 | player = find(2, 2007, @client) 25 | assert "1" = player["1"].interceptions 26 | end 27 | 28 | test "Return one week's player stats by player id, year, and week." do 29 | player = find(2, 2007, 1, @client) 30 | assert "1" = player.interceptions 31 | end 32 | 33 | test "Return stats from a single week QB stats record." do 34 | player_stats = find(14, 2013, 1, @client) 35 | 36 | assert "W23-17" = player_stats.final_score 37 | assert "0" = player_stats.fumbles 38 | assert "0" = player_stats.fumbles_lost 39 | assert "09/08" = player_stats.game_date 40 | assert "1" = player_stats.game_played 41 | assert "1" = player_stats.game_started 42 | assert "1" = player_stats.interceptions 43 | assert "ATL" = player_stats.opponent 44 | assert "35" = player_stats.pass_attempts 45 | assert "26" = player_stats.pass_completions 46 | assert "74.30" = player_stats.pass_percentage 47 | assert "2" = player_stats.pass_tds 48 | assert "357" = player_stats.pass_yards 49 | assert "10.20" = player_stats.pass_yards_average 50 | assert "14" = player_stats.player_id 51 | assert "113.60" = player_stats.qb_rating 52 | assert "3" = player_stats.rush_attempts 53 | assert "0" = player_stats.rush_tds 54 | assert "2" = player_stats.rush_yards 55 | assert "0.70" = player_stats.rush_yards_average 56 | assert "16" = player_stats.sack_yards 57 | assert "2" = player_stats.sacks 58 | assert "1" = player_stats.week 59 | assert "2013" = player_stats.year 60 | end 61 | 62 | test "Return stats from a single week WR stats record." do 63 | player_stats = find(1549, 2013, 1, @client) 64 | 65 | assert "W12-7" = player_stats.final_score 66 | assert "0" = player_stats.fumbles 67 | assert "0" = player_stats.fumbles_lost 68 | assert "09/08" = player_stats.game_date 69 | assert "1" = player_stats.game_played 70 | assert "0" = player_stats.game_started 71 | assert "@CAR" = player_stats.opponent 72 | assert "1549" = player_stats.player_id 73 | assert "0" = player_stats.rec_tds 74 | assert "91" = player_stats.rec_yards 75 | assert "13.00" = player_stats.rec_yards_average 76 | assert "7" = player_stats.receptions 77 | assert "1" = player_stats.rush_attempts 78 | assert "0" = player_stats.rush_tds 79 | assert "3" = player_stats.rush_yards 80 | assert "3.00" = player_stats.rush_yards_average 81 | assert "3" = player_stats.rush_yards_longest 82 | assert "1" = player_stats.week 83 | assert "2013" = player_stats.year 84 | end 85 | 86 | end 87 | -------------------------------------------------------------------------------- /test/ffnerd/player/video_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.Player.VideoTest do 2 | use ExUnit.Case 3 | import FFNerd.Player.Video 4 | 5 | doctest FFNerd.Player.Video 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of all player video records by player id." do 14 | assert [%FFNerd.Player.Video{} | _rest] = list(14, @client) 15 | end 16 | 17 | test "Return all video details from a player video record." do 18 | video = list(14, @client) |> List.first 19 | 20 | assert "NFL Top 100 Players of 2012 : Drew Brees #2" = video.video_title 21 | assert "9cMvQ-uD4aI" = video.youtube_id 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /test/ffnerd/player_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.PlayerTest do 2 | use ExUnit.Case 3 | import FFNerd.Player 4 | 5 | doctest FFNerd.Player 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of all player records." do 14 | assert [%FFNerd.Player{player_id: _} | _rest] = list(@client) 15 | end 16 | 17 | test "Return a list of player records by position code." do 18 | assert [%FFNerd.Player{position: "QB"} | _rest] = list("QB", @client) 19 | end 20 | 21 | test "Return a single player record by player id." do 22 | assert %FFNerd.Player{player_id: "2"} = find(2, @client) 23 | end 24 | 25 | test "Return a single player record by display name." do 26 | assert %FFNerd.Player{display_name: "Russell Wilson"} = find("Russell Wilson", @client) 27 | end 28 | 29 | test "Return the display name from a player record." do 30 | player = find(2, @client) 31 | assert "Derek Anderson" = player.display_name 32 | end 33 | 34 | test "Return all details from a player record." do 35 | player = find(2, @client) 36 | 37 | assert "1" = player.active 38 | assert "Oregon State" = player.college 39 | assert "Derek Anderson" = player.display_name 40 | assert "1983-06-15" = player.dob 41 | assert "Derek" = player.fname 42 | assert "6-6" = player.height 43 | assert "3" = player.jersey 44 | assert "Anderson" = player.lname 45 | assert "2" = player.player_id 46 | assert "QB" = player.position 47 | assert "CAR" = player.team 48 | assert "240" = player.weight 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /test/ffnerd/schedule_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.ScheduleTest do 2 | use ExUnit.Case 3 | import FFNerd.Schedule 4 | 5 | doctest FFNerd.Schedule 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return the associated current week." do 14 | assert 17 = current_week(@client) 15 | end 16 | 17 | test "Return a list of all game records." do 18 | assert [%FFNerd.Game{} | _rest] = list(@client) 19 | end 20 | 21 | test "Return a list of game records by team code." do 22 | assert [%FFNerd.Game{away_team: "SEA"} | _rest] = list("SEA", @client) 23 | end 24 | 25 | test "Return a single game record by game id." do 26 | assert %FFNerd.Game{game_id: "1"} = find(1, @client) 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /test/ffnerd/team_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.TeamTest do 2 | use ExUnit.Case 3 | import FFNerd.Team 4 | 5 | doctest FFNerd.Team 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of all team records." do 14 | assert [%{code: "ARI"} | _rest] = list(@client) 15 | end 16 | 17 | test "Return a single team record by team code." do 18 | assert %FFNerd.Team{code: "SEA"} = find("SEA", @client) 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /test/ffnerd/weather_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.WeatherTest do 2 | use ExUnit.Case 3 | import FFNerd.Weather 4 | 5 | doctest FFNerd.Weather 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return the associated current date." do 14 | assert "2014-09-02" = current_date(@client) 15 | end 16 | 17 | test "Return the associated current week." do 18 | assert "1" = current_week(@client) 19 | end 20 | 21 | test "Return a list of all weather forecast records." do 22 | assert [%FFNerd.Weather{} | _rest] = list(@client) 23 | end 24 | 25 | test "Return a single weather forecast record by game id." do 26 | assert %FFNerd.Weather{game_id: "1"} = find(1, @client) 27 | end 28 | 29 | test "Return a single weather forecast record by team code." do 30 | assert %FFNerd.Weather{home_team: "SEA"} = find("SEA", @client) 31 | end 32 | 33 | test "Return forecast from a weather record." do 34 | forecast = find("SEA", @client) 35 | 36 | assert "GB" = forecast.away_team 37 | assert "" = forecast.dome_img 38 | assert "Sunny" = forecast.forecast 39 | assert "2014-09-04" = forecast.game_date 40 | assert "1" = forecast.game_id 41 | assert "8:30 PM" = forecast.game_time_et 42 | assert "1" = forecast.game_week 43 | assert "47.595153" = forecast.geo_lat 44 | assert "-122.331625" = forecast.geo_long 45 | assert "76" = forecast.high 46 | assert "SEA" = forecast.home_team 47 | assert "0" = forecast.is_dome 48 | assert "56" = forecast.low 49 | assert "CenturyLink Field" = forecast.stadium 50 | assert "NBC" = forecast.tv_station 51 | assert "0" = forecast.wind_chill 52 | assert "0" = forecast.wind_speed 53 | 54 | assert "http://www.fantasyfootballnerd.com/images/weather/52/32.gif" 55 | = forecast.large_img 56 | assert "http://www.fantasyfootballnerd.com/images/weather/31/32.gif" 57 | = forecast.medium_img 58 | assert "http://www.fantasyfootballnerd.com/images/weather/20/32.gif" 59 | = forecast.small_img 60 | end 61 | 62 | end 63 | -------------------------------------------------------------------------------- /test/ffnerd/weekly_idp_ranking_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.WeeklyIDPRankingTest do 2 | use ExUnit.Case 3 | import FFNerd.WeeklyIDPRanking 4 | 5 | doctest FFNerd.WeeklyIDPRanking 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | test "Return a list of all weekly idp ranking records." do 14 | assert [%FFNerd.WeeklyIDPRanking{} | _rest] = list(@client) 15 | end 16 | 17 | test "Return a list of all weekly idp ranking records by position." do 18 | assert [%FFNerd.WeeklyIDPRanking{position: "DE"} | _rest] = list("DE", @client) 19 | end 20 | 21 | test "Return all details from a QB weekly projection record." do 22 | def_ranking = list("DE", @client) |> List.first 23 | 24 | assert "J.J. Watt" = def_ranking.player 25 | assert "DE" = def_ranking.position 26 | assert "1" = def_ranking.rank 27 | assert "HOU" = def_ranking.team 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /test/ffnerd/weekly_ranking_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerd.WeeklyRankingTest do 2 | use ExUnit.Case 3 | # import FFNerd.WeeklyRanking 4 | 5 | doctest FFNerd.WeeklyRanking 6 | 7 | @client FFNerd.Client.new("test") 8 | 9 | setup_all do 10 | HTTPoison.start 11 | end 12 | 13 | # NOTE: Tests are disabled due to missing test data from FFNerd. 14 | 15 | # test "Return a list of all weekly ranking records by position." do 16 | # assert [%FFNerd.WeeklyRanking{position: "QB"} | _rest] = list("QB", @client) 17 | # end 18 | 19 | # test "Return a list of all weekly ranking records by position and week." do 20 | # assert [%FFNerd.WeeklyRanking{position: "QB", week: "17"} | _rest] = list("QB", 17, @client) 21 | # end 22 | 23 | # test "Return a single weekly ranking record by person id." do 24 | # assert %FFNerd.WeeklyRanking{} = find(14, "QB", @client) 25 | # end 26 | 27 | # test "Return the details from an weekly ranking record." do 28 | # weekly_rankings = find(1446, "WR", @client) 29 | # 30 | # assert "Questionable" = weekly_rankings.game_status 31 | # assert "Knee" = weekly_rankings.injury 32 | # assert "2013-09-16" = weekly_rankings.last_update 33 | # assert "Julio Jones" = weekly_rankings.name 34 | # assert "1446" = weekly_rankings.player_id 35 | # assert "WR" = weekly_rankings.position 36 | # assert "19.60" = weekly_rankings.ppr 37 | # assert "23.30" = weekly_rankings.ppr_high 38 | # assert "16.00" = weekly_rankings.ppr_low 39 | # assert "14.00" = weekly_rankings.standard 40 | # assert "17.30" = weekly_rankings.standard_high 41 | # assert "9.00" = weekly_rankings.standard_low 42 | # assert "ATL" = weekly_rankings.team 43 | # assert "2" = weekly_rankings.week 44 | # 45 | # assert "Limited Participation in Practice" 46 | # = weekly_rankings.practice_status 47 | # end 48 | end 49 | -------------------------------------------------------------------------------- /test/ffnerd_test.exs: -------------------------------------------------------------------------------- 1 | defmodule FFNerdTest do 2 | use ExUnit.Case 3 | doctest FFNerd 4 | 5 | test "the truth" do 6 | assert 1 + 1 == 2 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/test_helper.exs: -------------------------------------------------------------------------------- 1 | ExUnit.start() 2 | # ExVCR.Config.cassette_library_dir("test/fixture/vcr_cassettes") 3 | --------------------------------------------------------------------------------