mlb 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e86303e2aa1810d5213ac3b1994bad065045a89f
4
+ data.tar.gz: 0e8c5d53d3912fcbc27a9eac8b53e6bb8cd5cc68
5
+ SHA512:
6
+ metadata.gz: 22d39a995a4edde5e03c3a4b294aaab99b94e5aa06db7cd0906f3ec5ea2a40435bf02be75337b2a1b23435590e7ccbe4705814765524f489fd7e9404332c313e
7
+ data.tar.gz: a89f2d8eb70401b875534421efd4b21ec92f32641528cc94a90b91e7169b24b05fd0f1515b584f306548fd6b32aaf06d0775766d1e0d907bde50474bb9f1ca58
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -39,8 +39,8 @@ Ideally, a bug report should include a pull request with failing specs.
39
39
  7. Run `open coverage/index.html`. If your changes are not completely covered
40
40
  by your tests, return to step 3.
41
41
  8. Add documentation for your feature or bug fix.
42
- 9. Run `bundle exec rake yard`. If your changes are not 100% documented, go
43
- back to step 8.
42
+ 9. Run `bundle exec rake verify_measurements`. If your changes are not 100%
43
+ documented, go back to step 8.
44
44
  10. Add, commit, and push your changes.
45
45
  11. [Submit a pull request.][pr]
46
46
 
data/README.md CHANGED
@@ -2,10 +2,14 @@
2
2
  [![Gem Version](https://badge.fury.io/rb/mlb.png)][gem]
3
3
  [![Build Status](https://secure.travis-ci.org/sferik/mlb.png?branch=master)][travis]
4
4
  [![Dependency Status](https://gemnasium.com/sferik/mlb.png?travis)][gemnasium]
5
+ [![Code Climate](https://codeclimate.com/github/sferik/mlb.png)][codeclimate]
6
+ [![Coverage Status](https://coveralls.io/repos/sferik/mlb/badge.png?branch=master)][coveralls]
5
7
 
6
8
  [gem]: https://rubygems.org/gems/mlb
7
9
  [travis]: http://travis-ci.org/sferik/mlb
8
10
  [gemnasium]: https://gemnasium.com/sferik/mlb
11
+ [codeclimate]: https://codeclimate.com/github/sferik/mlb
12
+ [coveralls]: https://coveralls.io/r/sferik/mlb
9
13
 
10
14
  MLB.rb is a Ruby library for retrieving current Major League Baseball players, managers, teams, divisions, and leagues.
11
15
 
@@ -16,7 +20,7 @@ To ensure the code you're installing hasn't been tampered with, it's
16
20
  recommended that you verify the signature. To do this, you need to add my
17
21
  public key as a trusted certificate (you only need to do this once):
18
22
 
19
- gem cert --add <(curl -Ls https://gist.github.com/sferik/4701180/raw/public_cert.pem)
23
+ gem cert --add <(curl -Ls https://raw.github.com/sferik/mlb/master/certs/sferik.pem)
20
24
 
21
25
  Then, install the gem with the high security trust policy:
22
26
 
@@ -52,6 +56,7 @@ implementations:
52
56
  * Ruby 1.9.2
53
57
  * Ruby 1.9.3
54
58
  * Ruby 2.0.0
59
+ * Ruby 2.1.0
55
60
  * [Rubinius][]
56
61
  * [JRuby][]
57
62
 
data/Rakefile CHANGED
@@ -5,18 +5,44 @@ require 'rspec/core/rake_task'
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
7
  task :test => :spec
8
- task :default => :spec
9
8
 
10
9
  namespace :cache do
11
10
  require 'mlb'
12
- desc "Update the teams file cache"
11
+ desc 'Update the teams file cache'
13
12
  task :update do
14
- doc = MLB::Team.results_from_freebase(true)
15
- File.open('cache/teams.json', 'w') do |file|
16
- file.write(doc.body)
13
+ json = MLB::Team.results_from_freebase
14
+ file = File.new('cache/teams.json', 'w+')
15
+ tempfile = Tempfile.new('teams.json')
16
+ tempfile.write(JSON.dump(json))
17
+ if system("python -mjson.tool #{tempfile.path} #{file.path}")
18
+ puts "File sucessfully written to #{file.path}"
19
+ tempfile.delete
20
+ else
21
+ abort "Error parsing #{tempfile.path}"
17
22
  end
18
23
  end
19
24
  end
20
25
 
26
+ begin
27
+ require 'rubocop/rake_task'
28
+ Rubocop::RakeTask.new
29
+ rescue LoadError
30
+ task :rubocop do
31
+ $stderr.puts 'Rubocop is disabled'
32
+ end
33
+ end
34
+
21
35
  require 'yard'
22
36
  YARD::Rake::YardocTask.new
37
+
38
+ require 'yardstick/rake/measurement'
39
+ Yardstick::Rake::Measurement.new do |measurement|
40
+ measurement.output = 'measurement/report.txt'
41
+ end
42
+
43
+ require 'yardstick/rake/verify'
44
+ Yardstick::Rake::Verify.new do |verify|
45
+ verify.threshold = 56.2
46
+ end
47
+
48
+ task :default => [:spec, :rubocop, :verify_measurements]
@@ -1,11 +1,8 @@
1
1
  module MLB
2
2
  class Player
3
- private_class_method :new
4
- attr_reader :name, :number, :position
3
+ attr_reader :name, :number, :positions, :from, :to
5
4
 
6
- private
7
-
8
- def initialize(attributes={})
5
+ def initialize(attributes = {})
9
6
  attributes.each do |key, value|
10
7
  instance_variable_set("@#{key}", value) if self.respond_to?(key)
11
8
  end
@@ -13,14 +10,15 @@ module MLB
13
10
 
14
11
  # Returns an array of Player objects given a team roster
15
12
  def self.all_from_roster(players)
16
- players.map do |player|
13
+ players.select { |player| player['to'].nil? }.map do |player|
17
14
  new(
18
- :name => player['player'],
19
- :number => player['number'],
20
- :position => player['position']
15
+ :name => player['player'],
16
+ :number => player['number'].to_i,
17
+ :positions => player['position'],
18
+ :from => player['from'].to_i,
19
+ :to => 'Present'
21
20
  )
22
21
  end
23
22
  end
24
-
25
23
  end
26
24
  end
@@ -1,22 +1,22 @@
1
1
  require 'faraday'
2
- require 'mlb/response/parse_json'
2
+ require 'faraday_middleware'
3
3
 
4
4
  module MLB
5
5
  # @private
6
6
  class Request
7
7
  # Perform an HTTP GET request
8
- def self.get(path, options={}, raw=false)
9
- response = connection(raw).get do |request|
8
+ def self.get(path, options = {})
9
+ connection.get do |request|
10
10
  request.url(path, options)
11
- end
12
- raw ? response : response.body
11
+ end.body
13
12
  end
14
13
 
15
- private
14
+ private
16
15
 
17
- def self.connection(raw=false)
18
- Faraday.new(:url => 'http://api.freebase.com') do |builder|
19
- builder.use MLB::Response::ParseJson unless raw
16
+ def self.connection
17
+ Faraday.new(:url => 'https://www.googleapis.com', :ssl => {:verify => false}) do |builder|
18
+ builder.request :url_encoded
19
+ builder.use FaradayMiddleware::ParseJson
20
20
  builder.adapter Faraday.default_adapter
21
21
  end
22
22
  end
@@ -3,7 +3,6 @@ require 'multi_json'
3
3
 
4
4
  module MLB
5
5
  class Team
6
- private_class_method :new
7
6
  attr_reader :name, :league, :division, :manager, :wins, :losses, :founded, :mascot, :ballpark, :logo_url, :players
8
7
 
9
8
  # Returns an array of Team objects
@@ -36,30 +35,28 @@ module MLB
36
35
  @all = nil
37
36
  end
38
37
 
39
- private
38
+ private
40
39
 
41
- def initialize(attributes={})
40
+ def initialize(attributes = {})
42
41
  attributes.each do |key, value|
43
42
  instance_variable_set("@#{key}", value) if self.respond_to?(key)
44
43
  end
45
44
  end
46
45
 
47
- def self.results_from_freebase(raw=false)
48
- options = {:query => mql_query}
49
- Request.get('/api/service/mqlread', options, raw)
46
+ def self.results_from_freebase
47
+ Request.get('/freebase/v1/mqlread', :query => mql_query)
50
48
  end
51
49
 
52
50
  def self.results_from_cache
53
- MultiJson.decode(file_from_cache("teams.json").read)
51
+ JSON.load(file_from_cache('teams.json').read)
54
52
  end
55
53
 
56
54
  def self.file_from_cache(file_name)
57
- File.new(File.expand_path("../../../cache", __FILE__) + "/" + file_name)
55
+ File.new(File.expand_path('../../../cache', __FILE__) + '/' + file_name)
58
56
  end
59
57
 
60
- def self.results_to_team(results)
61
- teams = []
62
- results['result'].each do |result|
58
+ def self.results_to_team(results) # rubocop:disable CyclomaticComplexity, MethodLength
59
+ results['result'].map do |result|
63
60
  league = result['league']
64
61
  division = result['division']
65
62
  manager = result['current_manager']
@@ -69,27 +66,24 @@ module MLB
69
66
  ballpark = result['/sports/sports_team/arena_stadium'].first
70
67
  logo_prefix = 'http://img.freebase.com/api/trans/image_thumb'
71
68
  logo_suffix = result['/common/topic/image'].first
72
- players = result['current_roster']
69
+ players = result['/sports/sports_team/roster']
73
70
 
74
- teams << new(
75
- :name => result['name'],
76
- :league => (league ? league['name'] : nil),
77
- :division => (division ? division['name'] : nil),
78
- :manager => (manager ? manager['name'] : nil),
79
- :wins => (stats ? stats['wins'].to_i : nil),
80
- :losses => (stats ? stats['losses'].to_i : nil),
81
- :founded => (founded ? founded['value'].to_i : nil),
82
- :mascot => (mascot ? mascot['name'] : nil),
83
- :ballpark => (ballpark ? ballpark['name'] : nil),
84
- :logo_url => (logo_suffix ? logo_prefix + logo_suffix['id'] : nil),
85
- :players => (players ? Player.all_from_roster(players) : [])
86
- )
71
+ new(:name => result['name'],
72
+ :league => (league ? league['name'] : nil),
73
+ :division => (division ? division['name'] : nil),
74
+ :manager => (manager ? manager['name'] : nil),
75
+ :wins => (stats ? stats['wins'].to_i : nil),
76
+ :losses => (stats ? stats['losses'].to_i : nil),
77
+ :founded => (founded ? founded['value'].to_i : nil),
78
+ :mascot => (mascot ? mascot['name'] : nil),
79
+ :ballpark => (ballpark ? ballpark['name'] : nil),
80
+ :logo_url => (logo_suffix ? logo_prefix + logo_suffix['id'] : nil),
81
+ :players => (players ? Player.all_from_roster(players) : []))
87
82
  end
88
- teams
89
83
  end
90
84
 
91
85
  # Returns the MQL query for teams, as a Ruby hash
92
- def self.mql_query
86
+ def self.mql_query # rubocop:disable MethodLength
93
87
  query = <<-eos
94
88
  [{
95
89
  "name": null,
@@ -100,6 +94,7 @@ module MLB
100
94
  "name": null
101
95
  },
102
96
  "current_manager": {
97
+ "optional": true,
103
98
  "name": null
104
99
  },
105
100
  "team_stats": [{
@@ -109,10 +104,12 @@ module MLB
109
104
  "limit": 1,
110
105
  "sort": "-season"
111
106
  }],
112
- "current_roster": [{
107
+ "/sports/sports_team/roster": [{
113
108
  "player": null,
114
- "position": null,
115
109
  "number": null,
110
+ "from": null,
111
+ "to": null,
112
+ "position": [],
116
113
  "sort": "player"
117
114
  }],
118
115
  "/sports/sports_team/founded": [{
@@ -123,6 +120,7 @@ module MLB
123
120
  "name": null
124
121
  }],
125
122
  "/common/topic/image": [{
123
+ "optional": true,
126
124
  "id": null,
127
125
  "timestamp": null,
128
126
  "sort": "-timestamp",
@@ -132,8 +130,7 @@ module MLB
132
130
  "type": "/baseball/baseball_team"
133
131
  }]
134
132
  eos
135
- '{"query":' + query.gsub!("\n", '').gsub!(' ', '') + '}'
133
+ query.gsub!("\n", '').gsub!(' ', '')
136
134
  end
137
-
138
135
  end
139
136
  end
@@ -1,3 +1,15 @@
1
1
  module MLB
2
- VERSION = "0.6.3" unless defined?(MLB::VERSION)
2
+ class Version
3
+ MAJOR = 0
4
+ MINOR = 7
5
+ PATCH = 0
6
+ PRE = nil
7
+
8
+ class << self
9
+ # @return [String]
10
+ def to_s
11
+ [MAJOR, MINOR, PATCH, PRE].compact.join('.')
12
+ end
13
+ end
14
+ end
3
15
  end
@@ -5,22 +5,23 @@ require 'mlb/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.add_dependency 'faraday', ['~> 0.8', '< 0.10']
8
- spec.add_dependency 'multi_json', '~> 1.0'
8
+ spec.add_dependency 'faraday_middleware', '~> 0.9'
9
+ spec.add_dependency 'json', '~> 1.8'
9
10
  spec.add_development_dependency 'bundler', '~> 1.0'
10
- spec.author = "Erik Michaels-Ober"
11
+ spec.author = 'Erik Michaels-Ober'
11
12
  spec.cert_chain = ['certs/sferik.pem']
12
13
  spec.description = %q{MLB.rb is a Ruby library for retrieving current Major League Baseball players, managers, teams, divisions, and leagues.}
13
14
  spec.email = 'sferik@gmail.com'
14
15
  spec.files = %w(.yardopts CONTRIBUTING.md LICENSE.md README.md Rakefile mlb.gemspec)
15
- spec.files += Dir.glob("lib/**/*.rb")
16
- spec.files += Dir.glob("spec/**/*")
16
+ spec.files += Dir.glob('lib/**/*.rb')
17
+ spec.files += Dir.glob('spec/**/*')
17
18
  spec.homepage = 'https://github.com/sferik/mlb'
18
19
  spec.licenses = ['MIT']
19
20
  spec.name = 'mlb'
20
21
  spec.require_paths = ['lib']
21
- spec.required_rubygems_version = '>= 1.3.6'
22
- spec.signing_key = File.expand_path("~/.gem/private_key.pem") if $0 =~ /gem\z/
22
+ spec.required_rubygems_version = '>= 1.3.5'
23
+ spec.signing_key = File.expand_path('~/.gem/private_key.pem') if $PROGRAM_NAME =~ /gem\z/
23
24
  spec.summary = spec.description
24
25
  spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
- spec.version = MLB::VERSION
26
+ spec.version = MLB::Version
26
27
  end
@@ -1,14 +1,22 @@
1
- unless ENV['CI']
2
- require 'simplecov'
3
- SimpleCov.start do
4
- add_filter 'spec'
5
- end
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
+ SimpleCov::Formatter::HTMLFormatter,
6
+ Coveralls::SimpleCov::Formatter
7
+ ]
8
+
9
+ SimpleCov.start do
10
+ add_filter '/spec/'
11
+ minimum_coverage(100)
6
12
  end
7
13
 
8
14
  require 'mlb'
9
15
  require 'rspec'
10
16
  require 'webmock/rspec'
11
17
 
18
+ WebMock.disable_net_connect!(:allow => 'coveralls.io')
19
+
12
20
  RSpec.configure do |config|
13
21
  config.expect_with :rspec do |c|
14
22
  c.syntax = :expect
@@ -16,7 +24,7 @@ RSpec.configure do |config|
16
24
  end
17
25
 
18
26
  def fixture_path
19
- File.expand_path("../../cache", __FILE__)
27
+ File.expand_path('../../cache', __FILE__)
20
28
  end
21
29
 
22
30
  def fixture(file)
@@ -1,53 +1,114 @@
1
1
  require 'helper'
2
2
 
3
- describe MLB::Team, ".all" do
4
- context "with connection" do
5
- before do
6
- stub_request(:get, 'http://api.freebase.com/api/service/mqlread').with(:query => {:query => MLB::Team.mql_query}).to_return(:body => fixture("teams.json"))
3
+ describe MLB::Team, '.all' do
4
+ before do
5
+ stub_request(:get, 'https://www.googleapis.com/freebase/v1/mqlread').with(:query => {:query => described_class.mql_query}).to_return(:body => fixture('teams.json'))
6
+ end
7
+ after do
8
+ described_class.reset
9
+ end
10
+ subject do
11
+ described_class.all
12
+ end
13
+ it 'there are thirty teams' do
14
+ expect(subject.size).to eq 30
15
+ end
16
+ it 'teams are sorted alphabetically, by name' do
17
+ # Arizona Diamondbacks..Washington Nationals
18
+ expect(subject).to eq subject.sort_by(&:name)
19
+ end
20
+ it 'every team belongs to a league' do
21
+ subject.each do |team|
22
+ expect(team.league).to match /^(American|National|Major) League( Baseball)?$/
7
23
  end
8
-
9
- after do
10
- MLB::Team.reset
24
+ end
25
+ it 'every team belongs to a division' do
26
+ subject.each do |team|
27
+ expect(team.division).to match /^(American|National) League (East|Central|West)$/
11
28
  end
12
-
13
- it "requests the correct resource" do
14
- MLB::Team.all
15
- expect(a_request(:get, 'http://api.freebase.com/api/service/mqlread').with(:query => {:query => MLB::Team.mql_query})).to have_been_made
29
+ end
30
+ it 'every team has win and loss statistics' do
31
+ subject.each do |team|
32
+ expect(team.wins).to be_between(0, 162), "got: #{team.wins} for #{team.name}"
33
+ expect(team.losses).to be_between(0, 162), "got: #{team.losses} for #{team.name}"
34
+ games = team.wins + team.losses
35
+ # Allow up to 163 total games, since there may be a tie-breaking game
36
+ expect(games).to be <= 163, "got: #{games} for #{team.name}"
16
37
  end
17
-
18
- it "returns the correct results" do
19
- teams = MLB::Team.all
20
- expect(teams.first.name).to eq "Arizona Diamondbacks"
38
+ end
39
+ it 'every team has a founding year' do
40
+ subject.each do |team|
41
+ # Chicago Cubs..Washington Nationals
42
+ expect(team.founded).to be_between(1870, 2005), "got: #{team.founded} for #{team.name}"
21
43
  end
22
44
  end
23
-
24
- context "with timeout" do
25
- before do
26
- stub_request(:get, 'http://api.freebase.com/api/service/mqlread').with(:query => {:query => MLB::Team.mql_query}).to_timeout
45
+ it 'every team has a ballpark' do
46
+ subject.each do |team|
47
+ expect(team.ballpark).to match /(Ballpark|Centre|Coliseum|Field|Park|Stadium)( (at|in|of) .+)?$/
27
48
  end
28
-
29
- after do
30
- MLB::Team.reset
49
+ end
50
+ it 'every team has a 25-player roster' do
51
+ subject.each do |team|
52
+ expect(team.players.size).to be >= 25, "got: #{team.players.size} for #{team.name}"
31
53
  end
32
-
33
- it "returns the correct results" do
34
- teams = MLB::Team.all
35
- expect(teams.first.name).to eq "Arizona Diamondbacks"
54
+ end
55
+ it 'every player has a first and last name' do
56
+ subject.each do |team|
57
+ team.players.each do |player|
58
+ expect(player.name.size).to be >= 7, "got: #{player.name.size} for #{player.name}"
59
+ expect(player.name.split.size).to be >= 2, "got: #{player.name.split.size} for #{player.name}"
60
+ end
61
+ end
62
+ end
63
+ it 'every player has a one- or two-digit number' do
64
+ subject.each do |team|
65
+ team.players.each do |player|
66
+ expect(player.number).to be_between(0, 99), "got: #{player.number} for #{player.name}"
67
+ # Jackie Robinson
68
+ expect(player.number).not_to eq(42), "got: #{player.number} for #{player.name}"
69
+ end
70
+ end
71
+ end
72
+ it 'every player has at least one position' do
73
+ subject.each do |team|
74
+ team.players.each do |player|
75
+ pending 'Some players do not have a position'
76
+ expect(player.positions.size).to be >= 1, "got: #{player.positions.size} for #{player.name}"
77
+ end
78
+ end
79
+ end
80
+ it 'every player has a starting year' do
81
+ subject.each do |team|
82
+ team.players.each do |player|
83
+ pending 'Some players do not have a starting year'
84
+ expect(player.from).to be >= 1995, "got: #{player.from} for #{player.name}"
85
+ end
86
+ end
87
+ end
88
+ it 'every player is active' do
89
+ subject.each do |team|
90
+ team.players.each do |player|
91
+ expect(player.to).to eq('Present'), "got: #{player.to} for #{player.name}"
92
+ end
36
93
  end
37
94
  end
38
95
 
39
- context "without connection" do
96
+ context 'with timeout' do
40
97
  before do
41
- stub_request(:get, 'http://api.freebase.com/api/service/mqlread').with(:query => {:query => MLB::Team.mql_query}).to_raise(SocketError)
98
+ stub_request(:get, 'https://www.googleapis.com/freebase/v1/mqlread').with(:query => {:query => described_class.mql_query}).to_timeout
42
99
  end
43
-
44
- after do
45
- MLB::Team.reset
100
+ it 'does not raise an exception' do
101
+ expect { subject }.not_to raise_exception
46
102
  end
103
+ end
47
104
 
48
- it "returns the correct results" do
49
- teams = MLB::Team.all
50
- expect(teams.first.name).to eq "Arizona Diamondbacks"
105
+ context 'without connection' do
106
+ before do
107
+ stub_request(:get, 'https://www.googleapis.com/freebase/v1/mqlread').with(:query => {:query => described_class.mql_query}).to_raise(SocketError)
108
+ end
109
+ it 'does not raise an exception' do
110
+ expect { subject }.not_to raise_exception
51
111
  end
52
112
  end
113
+
53
114
  end
metadata CHANGED
@@ -1,95 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mlb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
5
- prerelease:
4
+ version: 0.7.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Erik Michaels-Ober
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain:
12
- - !binary |-
13
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURMakNDQWhhZ0F3SUJB
14
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE5TVE4d0RRWURWUVFEREFaelpt
15
- VnkKYVdzeEZUQVRCZ29Ka2lhSmsvSXNaQUVaRmdWbmJXRnBiREVUTUJFR0Nn
16
- bVNKb21UOGl4a0FSa1dBMk52YlRBZQpGdzB4TXpBeU1ETXhNREF5TWpkYUZ3
17
- MHhOREF5TURNeE1EQXlNamRhTUQweER6QU5CZ05WQkFNTUJuTm1aWEpwCmF6
18
- RVZNQk1HQ2dtU0pvbVQ4aXhrQVJrV0JXZHRZV2xzTVJNd0VRWUtDWkltaVpQ
19
- eUxHUUJHUllEWTI5dE1JSUIKSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4
20
- QU1JSUJDZ0tDQVFFQWwweDVkeDh1S3hpN1Rrckl1eUJVVEpWQgp2MW85M25V
21
- QjlqL3k0TTk2Z1Yycll3QWNpMUpQQnNlTmQ2RnliempvM1lHdUhsN0VRSHVT
22
- SE5hZjFwMmx4ZXcvCnk2MEpYSUpCQmdQY0RLL0tDUDROVUhvZm0wamZvWUQr
23
- SDV1TkpmSENOcTcvWnNUeE90RTNSYTkyczBCQ01UcG0Kd0JNTWxXUjVNdGRF
24
- aElZdUJPNFhobmVqWWdIMEw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EuQ1PTEOYvQyao9UKMAAaAN/7qWQtjl0
30
+ hlw=
31
+ -----END CERTIFICATE-----
32
+ date: 2014-01-04 00:00:00.000000000 Z
40
33
  dependencies:
41
34
  - !ruby/object:Gem::Dependency
42
35
  name: faraday
43
36
  requirement: !ruby/object:Gem::Requirement
44
- none: false
45
37
  requirements:
46
- - - ~>
38
+ - - "~>"
47
39
  - !ruby/object:Gem::Version
48
40
  version: '0.8'
49
- - - <
41
+ - - "<"
50
42
  - !ruby/object:Gem::Version
51
43
  version: '0.10'
52
44
  type: :runtime
53
45
  prerelease: false
54
46
  version_requirements: !ruby/object:Gem::Requirement
55
- none: false
56
47
  requirements:
57
- - - ~>
48
+ - - "~>"
58
49
  - !ruby/object:Gem::Version
59
50
  version: '0.8'
60
- - - <
51
+ - - "<"
61
52
  - !ruby/object:Gem::Version
62
53
  version: '0.10'
63
54
  - !ruby/object:Gem::Dependency
64
- name: multi_json
55
+ name: faraday_middleware
65
56
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
57
  requirements:
68
- - - ~>
58
+ - - "~>"
69
59
  - !ruby/object:Gem::Version
70
- version: '1.0'
60
+ version: '0.9'
71
61
  type: :runtime
72
62
  prerelease: false
73
63
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
64
  requirements:
76
- - - ~>
65
+ - - "~>"
77
66
  - !ruby/object:Gem::Version
78
- version: '1.0'
67
+ version: '0.9'
68
+ - !ruby/object:Gem::Dependency
69
+ name: json
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.8'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.8'
79
82
  - !ruby/object:Gem::Dependency
80
83
  name: bundler
81
84
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
85
  requirements:
84
- - - ~>
86
+ - - "~>"
85
87
  - !ruby/object:Gem::Version
86
88
  version: '1.0'
87
89
  type: :development
88
90
  prerelease: false
89
91
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
92
  requirements:
92
- - - ~>
93
+ - - "~>"
93
94
  - !ruby/object:Gem::Version
94
95
  version: '1.0'
95
96
  description: MLB.rb is a Ruby library for retrieving current Major League Baseball
@@ -99,44 +100,42 @@ executables: []
99
100
  extensions: []
100
101
  extra_rdoc_files: []
101
102
  files:
102
- - .yardopts
103
+ - ".yardopts"
103
104
  - CONTRIBUTING.md
104
105
  - LICENSE.md
105
106
  - README.md
106
107
  - Rakefile
107
- - mlb.gemspec
108
+ - lib/mlb.rb
108
109
  - lib/mlb/player.rb
109
110
  - lib/mlb/request.rb
110
- - lib/mlb/response/parse_json.rb
111
111
  - lib/mlb/team.rb
112
112
  - lib/mlb/version.rb
113
- - lib/mlb.rb
113
+ - mlb.gemspec
114
114
  - spec/helper.rb
115
115
  - spec/mlb_spec.rb
116
116
  homepage: https://github.com/sferik/mlb
117
117
  licenses:
118
118
  - MIT
119
+ metadata: {}
119
120
  post_install_message:
120
121
  rdoc_options: []
121
122
  require_paths:
122
123
  - lib
123
124
  required_ruby_version: !ruby/object:Gem::Requirement
124
- none: false
125
125
  requirements:
126
- - - ! '>='
126
+ - - ">="
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  required_rubygems_version: !ruby/object:Gem::Requirement
130
- none: false
131
130
  requirements:
132
- - - ! '>='
131
+ - - ">="
133
132
  - !ruby/object:Gem::Version
134
- version: 1.3.6
133
+ version: 1.3.5
135
134
  requirements: []
136
135
  rubyforge_project:
137
- rubygems_version: 1.8.23
136
+ rubygems_version: 2.2.0
138
137
  signing_key:
139
- specification_version: 3
138
+ specification_version: 4
140
139
  summary: MLB.rb is a Ruby library for retrieving current Major League Baseball players,
141
140
  managers, teams, divisions, and leagues.
142
141
  test_files:
metadata.gz.sig CHANGED
Binary file
@@ -1,25 +0,0 @@
1
- require 'faraday'
2
- require 'multi_json'
3
-
4
- module MLB
5
- module Response
6
- class ParseJson < Faraday::Response::Middleware
7
-
8
- def parse(body)
9
- case body
10
- when /\A^\s*$\z/, nil
11
- nil
12
- else
13
- MultiJson.decode(body)
14
- end
15
- end
16
-
17
- def on_complete(env)
18
- if respond_to?(:parse)
19
- env[:body] = parse(env[:body]) unless [204, 301, 302, 304].include?(env[:status])
20
- end
21
- end
22
-
23
- end
24
- end
25
- end