cartola 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8432aab9ef994d29f087430fe3ae65602cf6117a
4
- data.tar.gz: 8775be03bb05a9c4c1c3a1b784e1a0678574fb7e
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjgxMjAzYWUxNWExNmE3YmZkNjYwMzk5ZDY3MGI4ZGQwZDYzMzMxZA==
5
+ data.tar.gz: !binary |-
6
+ ZjBhMDE1MWM1YjUwNjNhNTNhZmQ1ZjJlNTc5YjA5MmI4NmI0M2QyMw==
5
7
  SHA512:
6
- metadata.gz: 363b73289bc08f1932828eef623cea92272779f200b847c4198096d48a0463933e380a03fab17879d38cc9a7931fba01cd2ab8455dfbd76497ca6d01472f3fc6
7
- data.tar.gz: ee4e7f47db9e33f4dd1938f5f5b85367a152c7cb7c96d7ac46eebf639fef29195130e716596725780947c608a2a340481de7366aa035675da30d63444ff66863
8
+ metadata.gz: !binary |-
9
+ ZDY4NzE1ZjJlNjg3ZjU4Y2EzOGJkNjNjMTVhYmJjYzBiNTg4MTMwZmEyYjVi
10
+ NDg3ZTJjYWQ2OTMyNTMxZDg5YTE2OGY3ODU4NDUyODQ5Y2Q1NGZmNDE0NGU2
11
+ ZWI3NjA1MjU1ZjBjY2VhY2QxMzI1YjNkOGIwMjYzYWYwOGIzMTA=
12
+ data.tar.gz: !binary |-
13
+ YzNmYWFhZDdlOGE0ZjA2N2ExYjg0MWZjZDhlODBmODU3OWY2YjQxZjlhY2Q4
14
+ MTE0ZTUyNjgyZGIwNjRiMjY5OWVjYjU2OGE0ODNhMDZhN2Y4ZTFjMDJhMDJj
15
+ NTJhNzU4NzY4NjU5ZmUxNzQyMTUxZDM3NTQ3ZWQ4Yjg2M2Y5Zjg=
data/cartola-0.1.0.gem ADDED
Binary file
data/cartola-0.1.1.gem ADDED
Binary file
data/cartola.gemspec CHANGED
@@ -19,6 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.add_dependency "rest-client", "~> 1.8.0"
23
+ spec.add_dependency "rest_model", "~> 0.3.1"
24
+
22
25
  spec.add_development_dependency "bundler", "~> 1.11"
23
26
  spec.add_development_dependency "rake", "~> 10.0"
24
27
  spec.add_development_dependency "rspec", "~> 3.0"
data/lib/cartola.rb CHANGED
@@ -1,5 +1,16 @@
1
+ require "rest_model"
2
+ require "rest-client"
3
+
1
4
  require "cartola/version"
5
+ require "cartola/sponsor"
6
+ require "cartola/match"
7
+ require "cartola/matches"
8
+ require "cartola/team"
9
+ require "cartola/round"
10
+ require "cartola/market/shutdown"
11
+ require "cartola/market/status"
12
+ require "cartola/market/athlete"
13
+ require "cartola/market/highlight"
2
14
 
3
15
  module Cartola
4
- # Your code goes here...
5
16
  end
@@ -0,0 +1,18 @@
1
+ module Cartola
2
+ module Market
3
+ class Highlight < RestModel
4
+ properties :escalacoes,
5
+ :clube,
6
+ :escudo_clube,
7
+ :posicao
8
+
9
+ embeds_one :atleta, class_name: 'cartola/market/athlete', start_key: 'Atleta'
10
+
11
+ def self.find_all
12
+ response = RestClient.get 'https://api.cartolafc.globo.com/mercado/destaques'
13
+ json = JSON.parse response.body
14
+ from_source(json)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ module Cartola
2
+ module Market
3
+ class Status < RestModel
4
+ properties :rodada_atual,
5
+ :status_mercado,
6
+ :esquema_default_id,
7
+ :cartoleta_inicial,
8
+ :max_ligas_free,
9
+ :max_ligas_pro,
10
+ :max_ligas_matamata_free,
11
+ :max_ligas_matamata_pro,
12
+ :max_ligas_patrocinadas_free,
13
+ :max_ligas_patrocinadas_pro_num,
14
+ :game_over,
15
+ :times_escalados,
16
+ :mercado_pos_rodada
17
+
18
+ embeds_one :fechamento, class_name: 'cartola/market/shutdown'
19
+
20
+ def self.find
21
+ response = RestClient.get 'https://api.cartolafc.globo.com/mercado/status'
22
+ json = JSON.parse response.body
23
+ from_source(json).first
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,17 @@
1
+ module Cartola
2
+ class Match < RestModel
3
+ properties :clube_casa_id,
4
+ :clube_casa_posicao,
5
+ :aproveitamento_mandante,
6
+ :clube_visitante_id,
7
+ :clube_visitante_posicao,
8
+ :aproveitamento_visitante,
9
+ :partida_data,
10
+ :local,
11
+ :valida,
12
+ :placar_oficial_mandante,
13
+ :placar_oficial_visitante,
14
+ :url_confronto,
15
+ :url_transmissao
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module Cartola
2
+ class Matches < RestModel
3
+ property :rodada
4
+
5
+ embeds_many :partidas, class_name: Cartola::Match
6
+
7
+ def self.find_all
8
+ response = RestClient.get 'https://api.cartolafc.globo.com/partidas'
9
+ json = JSON.parse response.body
10
+ from_source(json)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module Cartola
2
+ class Model < RestModel
3
+ def self.config
4
+ Cartola::Configuration
5
+ end
6
+
7
+ def self.query
8
+ create_query
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ module Cartola
2
+ class Round < RestModel
3
+ properties :rodada_id,
4
+ :inicio,
5
+ :fim
6
+
7
+ def self.find(id)
8
+ self.find_all.find{ |r| r.rodada_id == id.to_s }
9
+ end
10
+
11
+ def self.find_all
12
+ response = RestClient.get 'https://api.cartolafc.globo.com/rodadas'
13
+ json = JSON.parse response.body
14
+ from_source(json)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ module Cartola
2
+ class Sponsor < RestModel
3
+ properties :liga_editorial_id,
4
+ :liga_id,
5
+ :servico_cadun,
6
+ :cor_nome_liga,
7
+ :tipo_ranking,
8
+ :url_link,
9
+ :cards,
10
+ :posicao_inicial,
11
+ :autorizacao_promocao,
12
+ :img_background,
13
+ :img_marca_patrocinador,
14
+ :nome
15
+
16
+ def self.find(id)
17
+ self.find_all.find{ |l| l.liga_editorial_id == id.to_s }
18
+ end
19
+
20
+ def self.find_all
21
+ response = RestClient.get 'https://api.cartolafc.globo.com/patrocinadores'
22
+ json = JSON.parse response.body
23
+ from_source(json)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,28 @@
1
+ module Cartola
2
+ class Team < RestModel
3
+ id
4
+ properties :nome,
5
+ :abreviacao,
6
+ :posicao
7
+
8
+ def self.find(id)
9
+ response = RestClient.get 'https://api.cartolafc.globo.com/clubes'
10
+ json = JSON.parse response.body
11
+ from_source(json[id.to_s])
12
+ end
13
+
14
+ def self.find_by_name(name)
15
+ self.find_all.find{ |t| t.nome == name }
16
+ end
17
+
18
+ def self.find_by_abbreviation(abbreviation)
19
+ self.find_all.select{ |t| t.abreviacao == abbreviation }
20
+ end
21
+
22
+ def self.find_all
23
+ response = RestClient.get 'https://api.cartolafc.globo.com/clubes'
24
+ json = JSON.parse response.body
25
+ from_source(json.values)
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Cartola
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartola
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rudnei Lucas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.8.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest_model
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.1
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,8 +95,18 @@ files:
67
95
  - Rakefile
68
96
  - bin/console
69
97
  - bin/setup
98
+ - cartola-0.1.0.gem
99
+ - cartola-0.1.1.gem
70
100
  - cartola.gemspec
71
101
  - lib/cartola.rb
102
+ - lib/cartola/market/highlight.rb
103
+ - lib/cartola/market/status.rb
104
+ - lib/cartola/match.rb
105
+ - lib/cartola/matches.rb
106
+ - lib/cartola/model.rb
107
+ - lib/cartola/round.rb
108
+ - lib/cartola/sponsor.rb
109
+ - lib/cartola/team.rb
72
110
  - lib/cartola/version.rb
73
111
  homepage: ''
74
112
  licenses:
@@ -80,12 +118,12 @@ require_paths:
80
118
  - lib
81
119
  required_ruby_version: !ruby/object:Gem::Requirement
82
120
  requirements:
83
- - - '>='
121
+ - - ! '>='
84
122
  - !ruby/object:Gem::Version
85
123
  version: '0'
86
124
  required_rubygems_version: !ruby/object:Gem::Requirement
87
125
  requirements:
88
- - - '>='
126
+ - - ! '>='
89
127
  - !ruby/object:Gem::Version
90
128
  version: '0'
91
129
  requirements: []