challonge-api 0.1.0 → 0.1.1

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.
@@ -1,8 +1,8 @@
1
+ # the only attributes that will save are: scores_csv, winner_id
2
+
1
3
  class Challonge::Match < Challonge::API
2
4
  self.site = "https://challonge.com/api/tournaments/:tournament_id"
3
5
 
4
- # the only attributes that will save are: scores_csv, winner_id
5
-
6
6
  def tournament
7
7
  Challonge::Tournament.find(self.prefix_options[:tournament_id])
8
8
  end
@@ -11,8 +11,10 @@ class Challonge::Match < Challonge::API
11
11
  self.prefix_options[:tournament_id] = tournament.id
12
12
  end
13
13
 
14
- # methods unsupported by API
14
+ # not implemented by API
15
15
  def create; end
16
+
17
+ # not implemented by API
16
18
  def destroy; end
17
19
 
18
20
  protected
@@ -1,7 +1,19 @@
1
+ # the only attributes that will save are: name, seed, challonge_username, email, misc
2
+
1
3
  class Challonge::Participant < Challonge::API
2
4
  self.site = "https://challonge.com/api/tournaments/:tournament_id"
3
5
 
4
- # the only attributes that will save are: name, seed, challonge_username, email, misc
6
+ def initialize(attributes = {})
7
+ @attributes = {}
8
+ @prefix_options = {}
9
+
10
+ # allow new and create to be passed a tournament or tournament_id
11
+ real_attributes = attributes.slice!(:tournament, :tournament_id, "tournament", "tournament_id")
12
+ load(real_attributes)
13
+ attributes.each_pair do |attr, val|
14
+ self.send("#{attr}=", val)
15
+ end
16
+ end
5
17
 
6
18
  def tournament
7
19
  Challonge::Tournament.find(self.prefix_options[:tournament_id])
@@ -23,7 +23,6 @@ class Challonge::Tournament < Challonge::API
23
23
  validated_post(:reset)
24
24
  end
25
25
 
26
- # associations
27
26
  def participants(scope = :all)
28
27
  Challonge::Participant.find(scope, :params => {:tournament_id => self.id})
29
28
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: challonge-api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - CHALLONGE!
@@ -15,10 +15,23 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-14 00:00:00 -05:00
18
+ date: 2010-12-17 00:00:00 -05:00
19
19
  default_executable:
20
- dependencies: []
21
-
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activeresource
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
22
35
  description:
23
36
  email: bitbucket@challonge.com
24
37
  executables: []
@@ -34,7 +47,7 @@ files:
34
47
  - lib/challonge/tournament.rb
35
48
  - lib/challonge-api.rb
36
49
  has_rdoc: true
37
- homepage: http://challonge.com
50
+ homepage: http://bitbucket.org/corneldm/challonge-api
38
51
  licenses: []
39
52
 
40
53
  post_install_message: