nrl 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 049c18b12a90c4fd393d7aff7c4d9a7820e8367e
4
+ data.tar.gz: ee51e5f0626eba6afaef12aa233c0e9f3e88d907
5
+ SHA512:
6
+ metadata.gz: 74450a26511d4691fdca2afb5569c12cf2b118dbf995a56678a22b04301f6b753c48343055284b9b1da4598079a9f63811f870d59bbcf62521a64bada6b716dd
7
+ data.tar.gz: 830d8d8b445f9e13902ed2665ddbcfb74cdcf56ede6c8da718ebc0a88c41498394d7abb985f610e9e107c0b004624812f12ebb86ec45d4f3251bd2504db328d8
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.0
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nrl.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Cameron Attard
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # NRL
2
+
3
+ A Ruby wrapper library for the NRL API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'nrl'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install nrl
20
+
21
+ ## Example Usage
22
+
23
+ ```ruby
24
+ NRL::Team.all
25
+
26
+ NRL::Round.all
27
+
28
+ NRL::Match.all
29
+ ```
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+
35
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cameronattard/nrl.
40
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nrl"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/lib/nrl.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+ require 'virtus'
4
+
5
+ require 'nrl/version'
6
+ require 'nrl/base'
7
+ require 'nrl/team'
8
+ require 'nrl/match'
9
+ require 'nrl/round'
10
+
11
+ module NRL
12
+ BASE_URL = 'https://tds-nrl-data.s3-ap-southeast-2.amazonaws.com/data/nrl'
13
+ end
data/lib/nrl/base.rb ADDED
@@ -0,0 +1,10 @@
1
+ module NRL
2
+ class Base
3
+ def self.connection
4
+ @conn ||= Faraday.new(BASE_URL) do |connection|
5
+ connection.adapter Faraday.default_adapter
6
+ connection.response :json, :content_type => /\bjson$/
7
+ end
8
+ end
9
+ end
10
+ end
data/lib/nrl/match.rb ADDED
@@ -0,0 +1,32 @@
1
+ module NRL
2
+ class Match < Base
3
+ include Virtus.model
4
+
5
+ attribute :id, Integer
6
+ attribute :round, Integer
7
+ attribute :match, Integer
8
+ attribute :home_squad_id, Integer
9
+ attribute :home_squad_odds, Float
10
+ attribute :home_squad_odds_id, Integer
11
+ attribute :away_squad_id, Integer
12
+ attribute :away_squad_odds, Float
13
+ attribute :away_squad_odds_id, Integer
14
+ attribute :venue_id, Integer
15
+ attribute :status, String
16
+ attribute :date, DateTime
17
+ attribute :is_first, Boolean
18
+ attribute :is_last, Boolean
19
+ attribute :is_match_day, Boolean
20
+ attribute :is_margin_game, Boolean
21
+ attribute :hashtag, String
22
+ attribute :venue_name, String
23
+ attribute :home_squad_name, String
24
+ attribute :away_squad_name, String
25
+ attribute :home_score, Integer
26
+ attribute :away_score, Integer
27
+
28
+ def self.all
29
+ Round.all.map { |round| round.matches }.flatten
30
+ end
31
+ end
32
+ end
data/lib/nrl/round.rb ADDED
@@ -0,0 +1,18 @@
1
+ module NRL
2
+ class Round < Base
3
+ include Virtus.model
4
+
5
+ attribute :id, Integer
6
+ attribute :status, String
7
+ attribute :start, DateTime
8
+ attribute :end, DateTime
9
+ attribute :bye_squads, Array[Integer]
10
+ attribute :is_final, Boolean
11
+ attribute :lifted_at, Integer
12
+ attribute :matches, Array[Match]
13
+
14
+ def self.all
15
+ connection.get('rounds.json').body.map { |attrs| Round.new(attrs) }
16
+ end
17
+ end
18
+ end
data/lib/nrl/team.rb ADDED
@@ -0,0 +1,20 @@
1
+ module NRL
2
+ class Team < Base
3
+ include Virtus.model
4
+
5
+ attribute :id, Integer
6
+ attribute :full_name, String
7
+ attribute :name, String
8
+ attribute :short_name, String
9
+ attribute :games, Integer
10
+ attribute :win, Integer
11
+ attribute :loss, Integer
12
+ attribute :draw, Integer
13
+ attribute :points, Integer
14
+ attribute :margin, Integer
15
+
16
+ def self.all
17
+ connection.get('ladder.json').body.map { |attrs| Team.new(attrs) }
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module NRL
2
+ VERSION = "0.1.0"
3
+ end
data/nrl.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nrl/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nrl"
8
+ spec.version = NRL::VERSION
9
+ spec.authors = ["Cameron Attard"]
10
+ spec.email = ["cameron.m.attard@gmail.com"]
11
+
12
+ spec.summary = "A Ruby wrapper library for the NRL API."
13
+ spec.homepage = "https://github.com/cameronattard/nrl"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.10"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+
23
+ spec.add_runtime_dependency "virtus", "~> 1.0"
24
+ spec.add_runtime_dependency "faraday", "~> 0.9"
25
+ spec.add_runtime_dependency "faraday_middleware", "~> 0.10"
26
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nrl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Cameron Attard
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: virtus
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: faraday
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday_middleware
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.10'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.10'
83
+ description:
84
+ email:
85
+ - cameron.m.attard@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".ruby-version"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - LICENSE
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - lib/nrl.rb
100
+ - lib/nrl/base.rb
101
+ - lib/nrl/match.rb
102
+ - lib/nrl/round.rb
103
+ - lib/nrl/team.rb
104
+ - lib/nrl/version.rb
105
+ - nrl.gemspec
106
+ homepage: https://github.com/cameronattard/nrl
107
+ licenses: []
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.4.5
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: A Ruby wrapper library for the NRL API.
129
+ test_files: []