binarybeast 0.2.1.pre → 0.2.2.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,42 @@
1
1
  module BinaryBeast
2
- class Team
2
+ class Team < BinaryBeast::Service
3
+ attr_accessor :id, :tourney_team_id, :user_id, :status, :display_name, :invoice_id, :notes, :player_count,
4
+ :network_display_name, :country, :country_code, :country_code_short, :wins, :lb_wins, :draws,
5
+ :player_password, :country_flag, :position, :bronze_wins, :spoiler_wins, :spoiler_lb_wins
6
+
7
+ def initialize(options={})
8
+ options[:id] = options[:id] || options['id'] || options[:tourney_team_id] || options['tourney_team_id']
9
+ assignAttributes(options)
10
+ end
11
+
12
+ def insert; end;
13
+
14
+ def update; end;
15
+
16
+ def list; end;
17
+
18
+ def getOpponent; end;
19
+
20
+ def reportWin; end;
21
+
22
+ def confirm; end;
23
+
24
+ def unconfirm; end;
25
+
26
+ def ban; end;
27
+
28
+ def delete; end;
29
+
30
+ class << self
31
+ def load(options={:force => false, :id => 'xSC21212194'})
32
+ id = options[:id] || options[:tourney_team_id] || 'xSC21212194'
33
+ BinaryBeast.call('Tourney.TourneyLoad.Team', :tourney_team_id => id) do |response|
34
+ return false if response["result"] != 200
35
+ return response if options[:force]
36
+ return BinaryBeast::Team.new(response["team_info"])
37
+ end
38
+ end
39
+ end
40
+
3
41
  end
4
42
  end
@@ -16,7 +16,7 @@ module BinaryBeast
16
16
  :team_mode, :teams_from_group, :max_teams, :group_count,
17
17
  :view_count, :date_start, :location,
18
18
  :replay_uploads, :replay_downloads,
19
- :description, :return_data
19
+ :description, :return_data, :teams
20
20
 
21
21
 
22
22
  # Default values for each attribute
@@ -259,6 +259,26 @@ module BinaryBeast
259
259
  options[:force] ? response : response['result'] == 200 ? true : false
260
260
  end
261
261
 
262
+ # loadTeams
263
+ # Method
264
+ # ----------------
265
+ # Should load all teams in the tourney and add them to the teams array variable
266
+ # Example:
267
+ # @tourney.loadTeams
268
+ # => true
269
+ # p @tourney.teams
270
+ # => [Team1, Team2, Team3]
271
+ # ----------------
272
+
273
+ def loadTeams(options={:force => false})
274
+ BinaryBeast.call('Tourney.TourneyLoad.Teams', :tourney_id => self.id) do |response|
275
+ return response if options[:force]
276
+ return false if response['result'] != 200
277
+ @teams = response['teams'].map { |t| BinaryBeast::Team.new(t)}
278
+ return true
279
+ end
280
+ end
281
+
262
282
  end
263
283
  # END Class Tournament
264
284
  end
@@ -1,3 +1,3 @@
1
1
  module BinaryBeast
2
- VERSION = "0.2.1.pre"
2
+ VERSION = "0.2.2.pre"
3
3
  end
@@ -1,6 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BinaryBeast::Team do
4
- it "should work" do
4
+ before :all do
5
+ @tourney = BinaryBeast::Tournament.load(:id => 'xSC21212194')
6
+ end
7
+ describe "Tournament.loadTeams" do
8
+ it "should load teams of tourney" do
9
+ @tourney.loadTeams
10
+ @tourney.should respond_to(:teams)
11
+ @tourney.teams.should be_instance_of Array
12
+ @tourney.teams[1].should be_instance_of BinaryBeast::Team
13
+ end
14
+ end
15
+ describe "should respond to" do
16
+ it "attributes" do
17
+ @tourney.teams[1].should respond_to(:tourney_team_id)
18
+ @tourney.teams[1].should respond_to(:display_name)
19
+ @tourney.teams[1].should respond_to(:country_code)
20
+ end
5
21
  end
6
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binarybeast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.pre
4
+ version: 0.2.2.pre
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: