binarybeast 0.0.2.pre → 0.1.3.pre

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.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Binarybeast
2
2
 
3
- TODO: Write a gem description
3
+ This is a Ruby Gem to access the BinaryBeast.com API. It was extracted from the [Gamkoi.com](http://www.gamkoi.com) Source Code and was written by Crispin Schäffler
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,12 +18,61 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ @tourney = Binarybeast::Tourney.new
22
22
 
23
- ## Contributing
23
+ there are several options you can use when creating a tourney:
24
24
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
25
+ :title => String
26
+ :description => String
27
+ :public => Integer
28
+ :gamecode => String
29
+ :typeid => Integer
30
+ :elimination => Integer
31
+ :teammode => Integer
32
+ :groupcount => Integer
33
+ :teamsfromgroup => Integer
34
+ :location => String
35
+ :maxteams => Integer
36
+ :replayuploads => Integer
37
+ :replaydownloads => Integer
38
+ :autostart => Integer
39
+ :returndata => Integer
40
+
41
+ however, only :title => String is required or :tourneyid => String if you want to load an existing tournament.
42
+
43
+ ## Create a new Tournament on BinaryBeast
44
+
45
+ @tourney = Binarybeast::Tourney.new(:title => "Test Tournament", :description => "This comes from a ruby gem accessing your api.")
46
+ @tourney.create
47
+
48
+ ## Fetching a existing Tournament from BinaryBeast
49
+
50
+ @tourney = Binarybeast::Tourney.new(:tourneyid => "xSC21212194")
51
+ @tourney.load
52
+
53
+ ## Current implemented Functions
54
+
55
+ This is a pre release of the gem soon to be. Current functions include
56
+
57
+ .new
58
+ .create
59
+ .update
60
+ .load
61
+ .delete
62
+ .setBuild
63
+ .setConfirmation
64
+ .start
65
+
66
+ more to come soon....
67
+
68
+ ## Some stuff you should know
69
+
70
+ The BinaryBeast API sends back JSON from every request. However, if you use this gem we catch the JSON Data and proccess it. If you want to have a direct access to the API you can go with something like this:
71
+
72
+ @tourney = Binarybeast::Tourney.new(:title => "Test")
73
+ response = @tourney.create(:force => true)
74
+
75
+ the :force => true tells the function to give you the callback from the binarybeast directly. The response is now a parsed hash, so this will work
76
+
77
+ response["Result"]
78
+ => 200
@@ -1,14 +1,11 @@
1
1
  require "HTTParty"
2
- Dir[File.dirname(__FILE__) + '/binarybeast/*.rb'].each do |file|
3
- require file
4
- end
5
2
 
6
3
  # Binarybeast
7
4
  # Module
8
5
  # ---------------------
9
- # has 1 variable called apikey, this is your apikey. the default is the apikey from gamkoi.com
6
+ # has 1 variable called api_key, this is your api_key. the default is the api_key from gamkoi.com
10
7
  # Example
11
- # Binarybeast.apikey = "12345"
8
+ # Binarybeast.api_key = "12345"
12
9
  # => "12345"
13
10
  # ---------------------
14
11
  # does contain all the classes that interact with binarybeast api.
@@ -19,204 +16,35 @@ module Binarybeast
19
16
  base_uri 'https://binarybeast.com/api'
20
17
  # Set HTTParty standard format to JSON, its standard what binarybeast api returns.
21
18
  format :json
22
- # Default APIKey, this one is taken from my personal account.
23
- @@apikey = "3c8955130c6e1406420d6202649651fe.50c9faa593f9c6.00530099"
19
+ # Default api_key, this one is taken from my personal account.
20
+ @@api_key = "3c8955130c6e1406420d6202649651fe.50c9faa593f9c6.00530099"
24
21
 
25
- # Getter for APIKey Variable
26
- def self.apikey
27
- @@apikey
22
+ # Autoload Tourney Class when needed
23
+ autoload :Tourney, 'binarybeast/tourney'
24
+ # Autoload Team Class when needed
25
+ autoload :Team, 'binarybeast/team'
26
+
27
+ # Getter for api_key Variable
28
+ def self.api_key
29
+ @@api_key
28
30
  end
29
31
 
30
- # Setter for APIKey Variable
31
- def self.apikey=(apikey)
32
- @@apikey=apikey
33
- end
34
-
35
- # Tourney
36
- # Class
37
- # ---------------
38
- # This is the Tourney class. It will be used to most. It gives you a brand new Tourney object to call methods on.
39
- # Example:
40
- # tourney = Binarybeast::Tourney.new("Gamkoi Test")
41
- # ---------------
42
- # gives you a tourney object
43
-
44
- class Tourney
45
- include HTTParty
46
- base_uri 'https://binarybeast.com/api'
47
- format :json
48
- attr_accessor :apikey, :tourneyid, :title, :publish, :gamecode, :typeid, :elimination, :teammode, :groupcount, :teamsfromgroup, :datestart, :location, :maxteams, :replayuploads, :replaydownloads, :description, :returndata
49
-
50
-
51
-
52
- # Constructor
53
- # Method
54
- # ----------------
55
- # all tourney attributes can be given here. The Name parameter is needed, all else is optional.
56
- # Example:
57
- # Tourney.new(:title => "Gamkoi DevCup")
58
- # ----------------
59
-
60
- def initialize(options={:title => "Gamkoi DevTest"})
61
- self.tourneyid = options[:tourneyid] if options[:tourneyid]
62
- options[:title] ? self.title = options[:title] : self.title = "Test"
63
- options[:public] ? self.publish = options[:public] : self.publish = 0
64
- options[:gamecode] ? self.gamecode = options[:gamecode] : self.gamecode = ""
65
- options[:typeid] ? self.typeid = options[:typeid] : self.typeid = 0
66
- options[:elimination] ? self.elimination = options[:elimination] : self.elimination = 1
67
- options[:teammode] ? self.teammode = options[:teammode] : self.teammode = 1
68
- options[:groupcount] ? self.groupcount = options[:groupcount] : self.groupcount = 1
69
- options[:teamsfromgroup] ? self.teamsfromgroup = options[:teamsfromgroup] : self.teamsfromgroup = 2
70
- options[:datestart] ? self.datestart = options[:datestart] : self.datestart = nil
71
- options[:location] ? self.location = options[:location] : self.location = ""
72
- options[:maxteams] ? self.maxteams = options[:maxteams] : self.maxteams = 16
73
- options[:replayuploads] ? self.replayuploads = options[:replayuploads] : self.replayuploads = 1
74
- options[:replaydownloads] ? self.replaydownloads = options[:replaydownloads] : self.replaydownloads = 1
75
- options[:description] ? self.description = options[:description] : self.description = ""
76
- options[:returndata] ? self.returndata = options[:returndata] : self.returndata = 0
77
- options[:apikey] ? self.apikey = options[:apikey] : self.apikey = Binarybeast.apikey
78
- end
79
-
80
-
81
- # Update
82
- # Method
83
- # ----------------
84
- # Pushes the attributes from the object to the binarybeast api. Pushes updates from object to Binarybeast
85
- # Example:
86
- # @tourney = Binarybeast::Tourney.new(:title => "lol")
87
- # @tourney.update
88
- # ----------------
89
-
90
- def update(options={:force => false})
91
- response = self.class.get("", :query => {:TourneyID => self.tourneyid, :APIKey => self.apikey, :APIService => "Tourney.TourneyUpdate.Settings",
92
- :Title => self.title, :Public => self.publish, :GameCode => self.gamecode,
93
- :TypeID => self.typeid, :Elimination => self.elimination,
94
- :TeamMode => self.teammode, :GroupCount => self.groupcount,
95
- :TeamsFromGroup => self.teamsfromgroup, :DateStart => self.datestart,
96
- :Location => self.location, :MaxTeams => self.maxteams, :ReplayUploads => self.replayuploads,
97
- :ReplayDownloads => self.replaydownloads, :Description => self.description, :ReturnData => self.returndata})
98
- options[:force] ? response : response["Result"] == 200 ? true : false
99
- end
100
-
101
- # Create
102
- # Method
103
- # ----------------
104
- # Creates the tournament object at binarybeast. You want to call this once after setting up your local Tourney object.
105
- # Example:
106
- # @tourney = Binarybeast::Tourny.new
107
- # @tourney.title = "Blabla"
108
- # @tourney.description = "Changing some attributes locally..."
109
- # @tourney.create
110
- # ----------------
111
-
112
- def create(options={:force => false})
113
- response = self.class.get("", :query => {:APIKey => self.apikey, :APIService => "Tourney.TourneyCreate.Create",
114
- :Title => self.title, :Public => self.publish, :GameCode => self.gamecode,
115
- :TypeID => self.typeid, :Elimination => self.elimination,
116
- :TeamMode => self.teammode, :GroupCount => self.groupcount,
117
- :TeamsFromGroup => self.teamsfromgroup, :DateStart => self.datestart,
118
- :Location => self.location, :MaxTeams => self.maxteams, :ReplayUploads => self.replayuploads,
119
- :ReplayDownloads => self.replaydownloads, :Description => self.description, :ReturnData => self.returndata})
120
- self.tourneyid = response["TourneyID"] if response["Result"] == 200
121
- options[:force] ? response : response["Result"] == 200 ? true : false
122
- end
123
-
124
- # Delete
125
- # Method
126
- # ----------------
127
- # Deletes the tourney object from binarybeast. Does not delete the tourney object itself locally.
128
- # Example:
129
- # @tourney = Binarybeast::Tourney.new(:title => "Test")
130
- # @tourney.create
131
- # @tourney.delete
132
- # ----------------
133
-
134
- def delete(options={:force => false})
135
- response = self.class.get("", :query => {:APIKey => self.apikey, :APIService => "Tourney.TourneyDelete.Delete", :TourneyID => self.tourneyid})
136
- options[:force] ? response : response["Result"] == 200 ? true : false
137
- end
138
-
139
- # Start
140
- # Method
141
- # ----------------
142
- # Starts the object tourney on binarybeast.
143
- # Example:
144
- # @tourney = Binarybeast::Tourney.new(:title => "test")
145
- # @tourney.create
146
- # @tourney.start
147
- # ----------------
148
-
149
- def start(options={:force => false})
150
- options[:force] ? force = true : force = false
151
- options[:seeding] ? seeding = options[:seeding] : seeding = "random"
152
- options[:teams] ? teams = options[:teams] : teams = nil
153
- response = self.class.get("", :query => {:APIKey => self.apikey, :APIService => "Tourney.TourneyStart.Start", :Seeding => seeding, :Teams => teams})
154
- options[:force] ? response : response["Result"] == 200 ? true : false
155
- end
156
-
157
- # Load
158
- # Method
159
- # ----------------
160
- # Loads the information of a binarybeast tourney and saving it in the object. Pulling information - inverse of update
161
- # Example:
162
- # @tourney = Binarybeast::Tourney.new(:tourneyid => "xSC21212194")
163
- # @tourney.load
164
- # ----------------
165
-
166
- def load(options={:force => false})
167
- response = self.class.get("", :query => {:APIKey => self.apikey, :APIService => "Tourney.TourneyLoad.Info", :TourneyID => self.tourneyid})
168
- return response if options[:force]
169
- if response["Result"] == 200
170
- self.title = response["TourneyInfo"]["Title"]
171
- self.publish = response["TourneyInfo"]["Public"]
172
- self.gamecode = response["TourneyInfo"]["GameCode"]
173
- self.typeid = response["TourneyInfo"]["TypeID"]
174
- self.elimination = response["TourneyInfo"]["Elimination"]
175
- self.teammode = response["TourneyInfo"]["TeamMode"]
176
- self.groupcount = response["TourneyInfo"]["GroupCount"]
177
- self.teamsfromgroup = response["TourneyInfo"]["TeamsFromGroup"]
178
- self.datestart = response["TourneyInfo"]["DateStart"]
179
- self.location = response["TourneyInfo"]["Location"]
180
- self.maxteams = response["TourneyInfo"]["MaxTeams"]
181
- self.replayuploads = response["TourneyInfo"]["ReplayUploads"]
182
- self.replaydownloads = response["TourneyInfo"]["ReplayDownloads"]
183
- self.description = response["TourneyInfo"]["Description"]
184
- self.returndata = response["TourneyInfo"]["ReturnData"]
185
- return true
186
- else
187
- return false
188
- end
189
- end
190
-
191
- # setBuilding
192
- # Method
193
- # ----------------
194
- # Sets the status of the tourney correlating to the object to: Status: Building
195
- # Example:
196
- # @tourney = Binarybeast::Tourney.new
197
- # @tourney.setBuilding
198
- # ----------------
199
-
200
- def setBuilding(options={:force => false})
201
- response = self.class.get("", :query => {:APIKey => self.apikey, :APIService => "Tourney.TourneySetStatus.Building", :TourneyID => self.tourneyid})
202
- options[:force] ? response : response["Result"] == 200 ? true : false
203
- end
204
-
205
- # setConfirmation
206
- # Method
207
- # ----------------
208
- # Sets the status of the tourney correlating to the object to: Status: Confirmation
209
- # Example:
210
- # @tourney = Binarybeast::Tourney.new
211
- # @tourney.setConfirmation
212
- # ----------------
32
+ # Setter for api_key Variable
33
+ def self.api_key=(api_key)
34
+ @@api_key=api_key
35
+ end
213
36
 
214
- def setConfirmation(options={:force => false})
215
- response = self.class.get("", :query => {:APIKey => self.apikey, :APIService => "Tourney.TourneySetStatus.Confirmation", :TourneyID => self.tourneyid})
216
- options[:force] ? response : response["Result"] == 200 ? true : false
217
- end
37
+ # Call
38
+ # Method
39
+ # ------------
40
+ # Raw Call Method for those who want to make raw calls on the API of Binarybeast. APIKey will be taken from the module variable
41
+ # Example:
42
+ # tourney = Binarybeast.call(:APIService => "Tourney.TourneyCreate.Create", :title => "Test")
43
+ # ------------
218
44
 
45
+ def self.call(options={})
46
+ options.merge!({:APIKey => @@api_key})
47
+ return self.get("", :query => options)
219
48
  end
220
- # END Class Tourney
221
49
 
222
50
  end
@@ -0,0 +1,4 @@
1
+ module Binarybeast
2
+ class Team
3
+ end
4
+ end
@@ -0,0 +1,238 @@
1
+ module Binarybeast
2
+ # Tourney
3
+ # Class
4
+ # ---------------
5
+ # This is the Tourney class. It will be used to most. It gives you a brand new Tourney object to call methods on.
6
+ # Example:
7
+ # tourney = Binarybeast::Tourney.new("Gamkoi Test")
8
+ # ---------------
9
+ # gives you a tourney object
10
+
11
+ class Tourney
12
+ include HTTParty
13
+ base_uri 'https://binarybeast.com/api'
14
+ format :json
15
+ attr_accessor :api_key, :id, :title, :publish, :game_code, :type_id, :elimination, :team_mode, :group_count, :teams_from_group, :date_start, :location, :max_teams, :replay_uploads, :replay_downloads, :description, :return_data
16
+
17
+ # Tourney Eigenclass
18
+ # Eigenclass
19
+ # ----------------
20
+ # provides some functionality in order to allow certain things before creating a tourney.
21
+ # ----------------
22
+
23
+ class << self
24
+ include HTTParty
25
+ format :json
26
+
27
+ # Load
28
+ # Method
29
+ # ----------------
30
+ # Loads a tourney from binarybeast and returns an tourney object.
31
+ # Example:
32
+ # @tourney = Binarybest::Tourney.load(:id => "xSC21212194")
33
+ # ----------------
34
+
35
+ def load(options={:force => false})
36
+ options[:id] ? id = options[:id] : id = "xSC21212194"
37
+ options[:force] ? force = options[:force] : force = false
38
+ response = self.get('https://binarybeast.com/api', :query => {:APIKey => Binarybeast.api_key, :APIService => "Tourney.TourneyLoad.Info", :TourneyID => id})
39
+ if response["Result"] == 200
40
+ return response if force
41
+ tourney = Binarybeast::Tourney.new( :id => id,
42
+ :title => response["TourneyInfo"]["Title"],
43
+ :publish => response["TourneyInfo"]["Public"],
44
+ :game_code => response["TourneyInfo"]["GameCode"],
45
+ :type_id => response["TourneyInfo"]["TypeID"],
46
+ :elimination => response["TourneyInfo"]["Elimination"],
47
+ :team_mode => response["TourneyInfo"]["TeamMode"],
48
+ :group_count => response["TourneyInfo"]["GroupCount"],
49
+ :teams_from_group => response["TourneyInfo"]["TeamsFromGroup"],
50
+ :date_start => response["TourneyInfo"]["DateStart"],
51
+ :location => response["TourneyInfo"]["Location"],
52
+ :max_teams => response["TourneyInfo"]["MaxTeams"],
53
+ :replay_uploads => response["TourneyInfo"]["ReplayUploads"],
54
+ :replay_downloads => response["TourneyInfo"]["ReplayDownloads"],
55
+ :description => response["TourneyInfo"]["Description"],
56
+ :return_data => response["TourneyInfo"]["ReturnData"],
57
+ :api_key => Binarybeast.api_key)
58
+ return tourney
59
+ else
60
+ return false
61
+ end
62
+ end
63
+ end
64
+
65
+ # END EIGENCLASS
66
+
67
+
68
+
69
+ # Constructor
70
+ # Method
71
+ # ----------------
72
+ # all tourney attributes can be given here. The title parameter is needed, all else is optional.
73
+ # Example:
74
+ # Binarybeast::Tourney.new(:title => "Gamkoi DevCup")
75
+ # ----------------
76
+
77
+ def initialize(options={:title => "Gamkoi DevTest"})
78
+ self.id = options[:id] if options[:id]
79
+ options[:title] ? self.title = options[:title] : self.title = "Test"
80
+ options[:public] ? self.publish = options[:public] : self.publish = 0
81
+ options[:game_code] ? self.game_code = options[:game_code] : self.game_code = ""
82
+ options[:type_id] ? self.type_id = options[:type_id] : self.type_id = 0
83
+ options[:elimination] ? self.elimination = options[:elimination] : self.elimination = 1
84
+ options[:team_mode] ? self.team_mode = options[:team_mode] : self.team_mode = 1
85
+ options[:group_count] ? self.group_count = options[:group_count] : self.group_count = 1
86
+ options[:teams_from_group] ? self.teams_from_group = options[:teams_from_group] : self.teams_from_group = 2
87
+ options[:date_start] ? self.date_start = options[:date_start] : self.date_start = nil
88
+ options[:location] ? self.location = options[:location] : self.location = ""
89
+ options[:max_teams] ? self.max_teams = options[:max_teams] : self.max_teams = 16
90
+ options[:replay_uploads] ? self.replay_uploads = options[:replay_uploads] : self.replay_uploads = 1
91
+ options[:replay_downloads] ? self.replay_downloads = options[:replay_downloads] : self.replay_downloads = 1
92
+ options[:description] ? self.description = options[:description] : self.description = ""
93
+ options[:return_data] ? self.return_data = options[:return_data] : self.return_data = 0
94
+ options[:api_key] ? self.api_key = options[:api_key] : self.api_key = Binarybeast.api_key
95
+ end
96
+
97
+
98
+ # Update
99
+ # Method
100
+ # ----------------
101
+ # Pushes the attributes from the object to the binarybeast api. Pushes updates from object to Binarybeast
102
+ # Example:
103
+ # @tourney = Binarybeast::Tourney.new(:title => "lol")
104
+ # @tourney.update
105
+ # ----------------
106
+
107
+ def update(options={:force => false})
108
+ response = self.class.get("", :query => {:id => self.id, :APIKey => self.api_key, :APIService => "Tourney.TourneyUpdate.Settings",
109
+ :Title => self.title, :Public => self.publish, :game_code => self.game_code,
110
+ :type_id => self.type_id, :Elimination => self.elimination,
111
+ :team_mode => self.team_mode, :group_count => self.group_count,
112
+ :teams_from_group => self.teams_from_group, :date_start => self.date_start,
113
+ :Location => self.location, :max_teams => self.max_teams, :replay_uploads => self.replay_uploads,
114
+ :replay_downloads => self.replay_downloads, :Description => self.description, :return_data => self.return_data})
115
+ options[:force] ? response : response["Result"] == 200 ? true : false
116
+ end
117
+
118
+ # Create
119
+ # Method
120
+ # ----------------
121
+ # Creates the tournament object at binarybeast. You want to call this once after setting up your local Tourney object.
122
+ # Example:
123
+ # @tourney = Binarybeast::Tourny.new
124
+ # @tourney.title = "Blabla"
125
+ # @tourney.description = "Changing some attributes locally..."
126
+ # @tourney.create
127
+ # ----------------
128
+
129
+ def create(options={:force => false})
130
+ response = self.class.get("", :query => {:APIKey => self.api_key, :APIService => "Tourney.TourneyCreate.Create",
131
+ :Title => self.title, :Public => self.publish, :GameCode => self.game_code,
132
+ :TypeID => self.type_id, :Elimination => self.elimination,
133
+ :TeamMode => self.team_mode, :GroupCount => self.group_count,
134
+ :TeamsFromGroup => self.teams_from_group, :DateStart => self.date_start,
135
+ :Location => self.location, :MaxTeams => self.max_teams, :ReplayUploads => self.replay_uploads,
136
+ :ReplayDownloads => self.replay_downloads, :Description => self.description, :ReturnData => self.return_data})
137
+ self.id = response["TourneyID"] if response["Result"] == 200
138
+ options[:force] ? response : response["Result"] == 200 ? true : false
139
+ end
140
+
141
+ # Delete
142
+ # Method
143
+ # ----------------
144
+ # Deletes the tourney object from binarybeast. Does not delete the tourney object itself locally.
145
+ # Example:
146
+ # @tourney = Binarybeast::Tourney.new(:title => "Test")
147
+ # @tourney.create
148
+ # @tourney.delete
149
+ # ----------------
150
+
151
+ def delete(options={:force => false})
152
+ response = self.class.get("", :query => {:APIKey => self.api_key, :APIService => "Tourney.TourneyDelete.Delete", :TourneyID => self.id})
153
+ options[:force] ? response : response["Result"] == 200 ? true : false
154
+ end
155
+
156
+ # Start
157
+ # Method
158
+ # ----------------
159
+ # Starts the object tourney on binarybeast.
160
+ # Example:
161
+ # @tourney = Binarybeast::Tourney.new(:title => "test")
162
+ # @tourney.create
163
+ # @tourney.start
164
+ # ----------------
165
+
166
+ def start(options={:force => false})
167
+ options[:force] ? force = true : force = false
168
+ options[:seeding] ? seeding = options[:seeding] : seeding = "random"
169
+ options[:teams] ? teams = options[:teams] : teams = nil
170
+ response = self.class.get("", :query => {:APIKey => self.api_key, :APIService => "Tourney.TourneyStart.Start", :Seeding => seeding, :Teams => teams, :TourneyID => self.id})
171
+ options[:force] ? response : response["Result"] == 200 ? true : false
172
+ end
173
+
174
+ # Load
175
+ # Method
176
+ # ----------------
177
+ # Loads the information of a binarybeast tourney and saving it in the object. Pulling information - inverse of update
178
+ # Example:
179
+ # @tourney = Binarybeast::Tourney.new(:id => "xSC21212194")
180
+ # @tourney.load
181
+ # ----------------
182
+
183
+ def load(options={:force => false})
184
+ response = self.class.get("", :query => {:APIKey => self.api_key, :APIService => "Tourney.TourneyLoad.Info", :TourneyID => self.id})
185
+ return response if options[:force]
186
+ if response["Result"] == 200
187
+ self.title = response["TourneyInfo"]["Title"]
188
+ self.publish = response["TourneyInfo"]["Public"]
189
+ self.game_code = response["TourneyInfo"]["GameCode"]
190
+ self.type_id = response["TourneyInfo"]["TypeID"]
191
+ self.elimination = response["TourneyInfo"]["Elimination"]
192
+ self.team_mode = response["TourneyInfo"]["TeamMode"]
193
+ self.group_count = response["TourneyInfo"]["GroupCount"]
194
+ self.teams_from_group = response["TourneyInfo"]["TeamsFromGroup"]
195
+ self.date_start = response["TourneyInfo"]["DateStart"]
196
+ self.location = response["TourneyInfo"]["Location"]
197
+ self.max_teams = response["TourneyInfo"]["MaxTeams"]
198
+ self.replay_uploads = response["TourneyInfo"]["ReplayUploads"]
199
+ self.replay_downloads = response["TourneyInfo"]["ReplayDownloads"]
200
+ self.description = response["TourneyInfo"]["Description"]
201
+ self.return_data = response["TourneyInfo"]["ReturnData"]
202
+ return true
203
+ else
204
+ return false
205
+ end
206
+ end
207
+
208
+ # setBuilding
209
+ # Method
210
+ # ----------------
211
+ # Sets the status of the tourney correlating to the object to: Status: Building
212
+ # Example:
213
+ # @tourney = Binarybeast::Tourney.new
214
+ # @tourney.setBuilding
215
+ # ----------------
216
+
217
+ def setBuilding(options={:force => false})
218
+ response = self.class.get("", :query => {:APIKey => self.api_key, :APIService => "Tourney.TourneySetStatus.Building", :TourneyID => self.id})
219
+ options[:force] ? response : response["Result"] == 200 ? true : false
220
+ end
221
+
222
+ # setConfirmation
223
+ # Method
224
+ # ----------------
225
+ # Sets the status of the tourney correlating to the object to: Status: Confirmation
226
+ # Example:
227
+ # @tourney = Binarybeast::Tourney.new
228
+ # @tourney.setConfirmation
229
+ # ----------------
230
+
231
+ def setConfirmation(options={:force => false})
232
+ response = self.class.get("", :query => {:APIKey => self.api_key, :APIService => "Tourney.TourneySetStatus.Confirmation", :TourneyID => self.id})
233
+ options[:force] ? response : response["Result"] == 200 ? true : false
234
+ end
235
+
236
+ end
237
+ # END Class Tourney
238
+ end
@@ -1,3 +1,3 @@
1
1
  module Binarybeast
2
- VERSION = "0.0.2.pre"
2
+ VERSION = "0.1.3.pre"
3
3
  end
@@ -2,6 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe Binarybeast do
4
4
  it "must have apikey variable" do
5
- Binarybeast.apikey.should == "3c8955130c6e1406420d6202649651fe.50c9faa593f9c6.00530099"
5
+ Binarybeast.api_key.should == "3c8955130c6e1406420d6202649651fe.50c9faa593f9c6.00530099"
6
+ end
7
+ it "should have a raw call method" do
8
+ Binarybeast.should respond_to(:call)
6
9
  end
7
10
  end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe Binarybeast::Team do
4
+ it "should work" do
5
+ end
6
+ end
@@ -4,6 +4,13 @@ describe Binarybeast::Tourney do
4
4
  before :all do
5
5
  @tourney = Binarybeast::Tourney.new(:title => "Gamkoi DevTest Ruby", :description => "This is a tourney created via the Gamkoi.com ruby gem.")
6
6
  end
7
+ describe "load" do
8
+ it "should load from eigenclass" do
9
+ tourney = Binarybeast::Tourney.load(:id => "xSC21212194")
10
+ tourney.should be_an_instance_of Binarybeast::Tourney
11
+ tourney.title.should eq("Gamkoi Dev Dummy")
12
+ end
13
+ end
7
14
  describe "new" do
8
15
  it "takes one to all parameters and returns an tourney object" do
9
16
  @tourney.should be_an_instance_of Binarybeast::Tourney
@@ -16,22 +23,22 @@ describe Binarybeast::Tourney do
16
23
  end
17
24
  it "should respond to all attributes" do
18
25
  @tourney.should respond_to(:title)
19
- @tourney.should respond_to(:tourneyid)
26
+ @tourney.should respond_to(:id)
20
27
  @tourney.should respond_to(:publish)
21
- @tourney.should respond_to(:gamecode)
22
- @tourney.should respond_to(:typeid)
28
+ @tourney.should respond_to(:game_code)
29
+ @tourney.should respond_to(:type_id)
23
30
  @tourney.should respond_to(:elimination)
24
- @tourney.should respond_to(:teammode)
25
- @tourney.should respond_to(:groupcount)
26
- @tourney.should respond_to(:teamsfromgroup)
27
- @tourney.should respond_to(:datestart)
31
+ @tourney.should respond_to(:team_mode)
32
+ @tourney.should respond_to(:group_count)
33
+ @tourney.should respond_to(:teams_from_group)
34
+ @tourney.should respond_to(:date_start)
28
35
  @tourney.should respond_to(:location)
29
- @tourney.should respond_to(:maxteams)
30
- @tourney.should respond_to(:replayuploads)
31
- @tourney.should respond_to(:replaydownloads)
36
+ @tourney.should respond_to(:max_teams)
37
+ @tourney.should respond_to(:replay_uploads)
38
+ @tourney.should respond_to(:replay_downloads)
32
39
  @tourney.should respond_to(:description)
33
- @tourney.should respond_to(:returndata)
34
- @tourney.should respond_to(:apikey)
40
+ @tourney.should respond_to(:return_data)
41
+ @tourney.should respond_to(:api_key)
35
42
  end
36
43
  end
37
44
  describe "update" do
@@ -77,7 +84,7 @@ describe Binarybeast::Tourney do
77
84
  @tourney.should respond_to(:load)
78
85
  end
79
86
  it "should load a tourney and set attributes" do
80
- tourney = Binarybeast::Tourney.new(:tourneyid => "xSC21212194")
87
+ tourney = Binarybeast::Tourney.new(:id => "xSC21212194")
81
88
  tourney.load
82
89
  tourney.title.should eq("Gamkoi Dev Dummy")
83
90
  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.0.2.pre
4
+ version: 0.1.3.pre
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-19 00:00:00.000000000 Z
12
+ date: 2012-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -89,9 +89,12 @@ files:
89
89
  - Rakefile
90
90
  - binarybeast.gemspec
91
91
  - lib/binarybeast.rb
92
+ - lib/binarybeast/team.rb
93
+ - lib/binarybeast/tourney.rb
92
94
  - lib/binarybeast/version.rb
93
95
  - spec/binarybeast_spec.rb
94
96
  - spec/spec_helper.rb
97
+ - spec/team_spec.rb
95
98
  - spec/tourney_spec.rb
96
99
  homepage: ''
97
100
  licenses: []
@@ -120,4 +123,5 @@ summary: Ruby gem to access the binary beast api.
120
123
  test_files:
121
124
  - spec/binarybeast_spec.rb
122
125
  - spec/spec_helper.rb
126
+ - spec/team_spec.rb
123
127
  - spec/tourney_spec.rb