binarybeast 0.1.4.pre → 0.1.5.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 +3 -1
- data/lib/binarybeast/tourney.rb +33 -0
- data/lib/binarybeast/version.rb +1 -1
- data/spec/tourney_spec.rb +19 -5
- metadata +1 -1
data/README.md
CHANGED
@@ -68,7 +68,7 @@ more to come soon....
|
|
68
68
|
|
69
69
|
### :force => true
|
70
70
|
|
71
|
-
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
|
71
|
+
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 response from the API you can go with something like this:
|
72
72
|
|
73
73
|
@tourney = Binarybeast::Tourney.new(:title => "Test")
|
74
74
|
response = @tourney.create(:force => true)
|
@@ -78,6 +78,8 @@ the :force => true tells the function to give you the callback from the binarybe
|
|
78
78
|
response["Result"]
|
79
79
|
=> 200
|
80
80
|
|
81
|
+
the :force options is currently available to almost every function, the exception is Binarybeast::Tourney.new since this creates the ruby object and does not do an API Call.
|
82
|
+
|
81
83
|
## Changelog
|
82
84
|
|
83
85
|
### Version: 0.1.3.pre
|
data/lib/binarybeast/tourney.rb
CHANGED
@@ -60,6 +60,39 @@ module Binarybeast
|
|
60
60
|
return false
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
# List
|
65
|
+
# Method
|
66
|
+
# ----------------
|
67
|
+
# Loads the List of Tourneys you've created. Returns an hash if successful, else false
|
68
|
+
# Example:
|
69
|
+
# @tourneylist = Binarybeast::Tourney.list
|
70
|
+
# ----------------
|
71
|
+
|
72
|
+
def list(options={:order => "DateStart"})
|
73
|
+
options[:api_key] ? api_key = options[:api_key] : api_key = Binarybeast.api_key
|
74
|
+
options[:order] ? order = options[:order] : order = "DateStart"
|
75
|
+
options[:direction] ? direction = options[:direction] : direction = "DESC"
|
76
|
+
options[:verbose] ? verbose = options[:verbose] : verbose = false
|
77
|
+
response = self.get('https://binarybeast.com/api', :query => {:APIKey => api_key, :APIService => "Tourney.TourneyList.My", :Order => order, :Direction => direction, :Verbose => verbose})
|
78
|
+
response["Result"] == 200 ? response : false
|
79
|
+
end
|
80
|
+
|
81
|
+
# ListPopular
|
82
|
+
# Method
|
83
|
+
# ----------------
|
84
|
+
# Loads the List of Popular Tourneys. Retuns an hash if successful, else false
|
85
|
+
# Example:
|
86
|
+
# @tourneylist = Binarybeast::Tourney.listpopular
|
87
|
+
# ----------------
|
88
|
+
|
89
|
+
def listpopular(options={:limit => 30})
|
90
|
+
options[:limit] ? limit = options[:limit] : limit = 30
|
91
|
+
options[:api_key] ? api_key = options[:api_key] : api_key = Binarybeast.api_key
|
92
|
+
response = self.get('https://binarybeast.com/api', :query => {:APIKey => api_key, :APIService => "Tourney.TourneyList.Popular", :Limit => limit})
|
93
|
+
response["Result"] == 200 ? response : false
|
94
|
+
end
|
95
|
+
|
63
96
|
end
|
64
97
|
|
65
98
|
# END EIGENCLASS
|
data/lib/binarybeast/version.rb
CHANGED
data/spec/tourney_spec.rb
CHANGED
@@ -4,11 +4,25 @@ 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 "
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
describe "eigenclass" do
|
8
|
+
describe "list" do
|
9
|
+
it "should return list of tourneys" do
|
10
|
+
response = Binarybeast::Tourney.list
|
11
|
+
response.should be_instance_of Hash
|
12
|
+
end
|
13
|
+
end
|
14
|
+
describe "listpopular" do
|
15
|
+
it "should return list of popular tourneys" do
|
16
|
+
response = Binarybeast::Tourney.listpopular
|
17
|
+
response.should be_instance_of Hash
|
18
|
+
end
|
19
|
+
end
|
20
|
+
describe "load" do
|
21
|
+
it "should load from eigenclass" do
|
22
|
+
tourney = Binarybeast::Tourney.load(:id => "xSC21212194")
|
23
|
+
tourney.should be_an_instance_of Binarybeast::Tourney
|
24
|
+
tourney.title.should eq("Gamkoi Dev Dummy")
|
25
|
+
end
|
12
26
|
end
|
13
27
|
end
|
14
28
|
describe "new" do
|