big_door 0.0.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.
- data/History.txt +4 -0
- data/Manifest.txt +72 -0
- data/README.rdoc +170 -0
- data/Rakefile +32 -0
- data/autotest/discover.rb +1 -0
- data/big_door.gemspec +56 -0
- data/bin/example.rb +93 -0
- data/features/resources/attribute.feature +41 -0
- data/features/resources/currency_type.feature +12 -0
- data/features/resources/end_user.feature +92 -0
- data/features/resources/named_award_collection.feature +42 -0
- data/features/resources/named_good_collection.feature +40 -0
- data/features/resources/named_level_collection.feature +44 -0
- data/features/resources/url.feature +41 -0
- data/features/step_definitions/resources_steps.rb +370 -0
- data/features/support/env.rb +9 -0
- data/lib/big_door/attribute.rb +21 -0
- data/lib/big_door/award.rb +24 -0
- data/lib/big_door/client.rb +281 -0
- data/lib/big_door/currency.rb +26 -0
- data/lib/big_door/currency_balance.rb +27 -0
- data/lib/big_door/currency_type.rb +29 -0
- data/lib/big_door/end_user.rb +32 -0
- data/lib/big_door/good.rb +32 -0
- data/lib/big_door/leaderboard.rb +41 -0
- data/lib/big_door/level.rb +25 -0
- data/lib/big_door/named_award.rb +24 -0
- data/lib/big_door/named_award_collection.rb +21 -0
- data/lib/big_door/named_good.rb +24 -0
- data/lib/big_door/named_good_collection.rb +22 -0
- data/lib/big_door/named_level.rb +26 -0
- data/lib/big_door/named_level_collection.rb +23 -0
- data/lib/big_door/named_transaction.rb +21 -0
- data/lib/big_door/named_transaction_group.rb +74 -0
- data/lib/big_door/profile.rb +28 -0
- data/lib/big_door/resource.rb +204 -0
- data/lib/big_door/resource_end_user.rb +84 -0
- data/lib/big_door/resource_with_association.rb +37 -0
- data/lib/big_door/resource_with_parent.rb +43 -0
- data/lib/big_door/url.rb +21 -0
- data/lib/big_door.rb +40 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/big_door/attribute_spec.rb +18 -0
- data/spec/big_door/award_spec.rb +19 -0
- data/spec/big_door/client_spec.rb +163 -0
- data/spec/big_door/currency_balance_spec.rb +14 -0
- data/spec/big_door/currency_spec.rb +81 -0
- data/spec/big_door/currency_type_spec.rb +21 -0
- data/spec/big_door/end_user_spec.rb +23 -0
- data/spec/big_door/good_spec.rb +14 -0
- data/spec/big_door/leaderboard_spec.rb +15 -0
- data/spec/big_door/level_spec.rb +19 -0
- data/spec/big_door/named_award_collection_spec.rb +23 -0
- data/spec/big_door/named_award_spec.rb +23 -0
- data/spec/big_door/named_good_collection_spec.rb +23 -0
- data/spec/big_door/named_good_spec.rb +23 -0
- data/spec/big_door/named_level_collection_spec.rb +23 -0
- data/spec/big_door/named_level_spec.rb +24 -0
- data/spec/big_door/named_transaction_group_spec.rb +29 -0
- data/spec/big_door/named_transaction_spec.rb +23 -0
- data/spec/big_door/profile_spec.rb +19 -0
- data/spec/big_door/resource_end_user_spec.rb +22 -0
- data/spec/big_door/resource_spec.rb +22 -0
- data/spec/big_door/resource_with_association_spec.rb +23 -0
- data/spec/big_door/resource_with_parent_spec.rb +22 -0
- data/spec/big_door/url_spec.rb +23 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +17 -0
- data/tasks/cucumber.rake +5 -0
- data/tasks/rspec.rake +29 -0
- metadata +263 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.rdoc
|
4
|
+
Rakefile
|
5
|
+
autotest/discover.rb
|
6
|
+
big_door.gemspec
|
7
|
+
bin/example.rb
|
8
|
+
features/resources/attribute.feature
|
9
|
+
features/resources/currency_type.feature
|
10
|
+
features/resources/end_user.feature
|
11
|
+
features/resources/named_award_collection.feature
|
12
|
+
features/resources/named_good_collection.feature
|
13
|
+
features/resources/named_level_collection.feature
|
14
|
+
features/resources/url.feature
|
15
|
+
features/step_definitions/resources_steps.rb
|
16
|
+
features/support/env.rb
|
17
|
+
lib/big_door.rb
|
18
|
+
lib/big_door/attribute.rb
|
19
|
+
lib/big_door/award.rb
|
20
|
+
lib/big_door/client.rb
|
21
|
+
lib/big_door/currency.rb
|
22
|
+
lib/big_door/currency_balance.rb
|
23
|
+
lib/big_door/currency_type.rb
|
24
|
+
lib/big_door/end_user.rb
|
25
|
+
lib/big_door/good.rb
|
26
|
+
lib/big_door/leaderboard.rb
|
27
|
+
lib/big_door/level.rb
|
28
|
+
lib/big_door/named_award.rb
|
29
|
+
lib/big_door/named_award_collection.rb
|
30
|
+
lib/big_door/named_good.rb
|
31
|
+
lib/big_door/named_good_collection.rb
|
32
|
+
lib/big_door/named_level.rb
|
33
|
+
lib/big_door/named_level_collection.rb
|
34
|
+
lib/big_door/named_transaction.rb
|
35
|
+
lib/big_door/named_transaction_group.rb
|
36
|
+
lib/big_door/profile.rb
|
37
|
+
lib/big_door/resource.rb
|
38
|
+
lib/big_door/resource_end_user.rb
|
39
|
+
lib/big_door/resource_with_association.rb
|
40
|
+
lib/big_door/resource_with_parent.rb
|
41
|
+
lib/big_door/url.rb
|
42
|
+
script/console
|
43
|
+
script/destroy
|
44
|
+
script/generate
|
45
|
+
spec/big_door/attribute_spec.rb
|
46
|
+
spec/big_door/award_spec.rb
|
47
|
+
spec/big_door/client_spec.rb
|
48
|
+
spec/big_door/currency_balance_spec.rb
|
49
|
+
spec/big_door/currency_spec.rb
|
50
|
+
spec/big_door/currency_type_spec.rb
|
51
|
+
spec/big_door/end_user_spec.rb
|
52
|
+
spec/big_door/good_spec.rb
|
53
|
+
spec/big_door/leaderboard_spec.rb
|
54
|
+
spec/big_door/level_spec.rb
|
55
|
+
spec/big_door/named_award_collection_spec.rb
|
56
|
+
spec/big_door/named_award_spec.rb
|
57
|
+
spec/big_door/named_good_collection_spec.rb
|
58
|
+
spec/big_door/named_good_spec.rb
|
59
|
+
spec/big_door/named_level_collection_spec.rb
|
60
|
+
spec/big_door/named_level_spec.rb
|
61
|
+
spec/big_door/named_transaction_group_spec.rb
|
62
|
+
spec/big_door/named_transaction_spec.rb
|
63
|
+
spec/big_door/profile_spec.rb
|
64
|
+
spec/big_door/resource_end_user_spec.rb
|
65
|
+
spec/big_door/resource_spec.rb
|
66
|
+
spec/big_door/resource_with_association_spec.rb
|
67
|
+
spec/big_door/resource_with_parent_spec.rb
|
68
|
+
spec/big_door/url_spec.rb
|
69
|
+
spec/spec.opts
|
70
|
+
spec/spec_helper.rb
|
71
|
+
tasks/cucumber.rake
|
72
|
+
tasks/rspec.rake
|
data/README.rdoc
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
= bigdoorkit
|
2
|
+
|
3
|
+
* http://bitbucket.org/AlexeyDemidov/bigdoorkit-ruby/
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Client library for the BigDoor REST API (http://bigdoor.com). This package
|
8
|
+
provides both low-level procedural (BigDoor::Client) and object-oriented
|
9
|
+
(BigDoor::Resource object hierarchy) interfaces to BigDoor REST API.
|
10
|
+
|
11
|
+
== FEATURES/PROBLEMS:
|
12
|
+
|
13
|
+
See documentation for BigDoor REST API at http://publisher.bigdoor.com/
|
14
|
+
|
15
|
+
== SYNOPSIS:
|
16
|
+
|
17
|
+
require 'rubygems'
|
18
|
+
require 'bigdoor'
|
19
|
+
|
20
|
+
# see API Keys http://publisher.bigdoor.com/
|
21
|
+
APP_KEY = '28d3da80bf36fad415ab57b3130c6cb6'
|
22
|
+
APP_SECRET = 'B66F956ED83AE218612CB0FBAC2EF01C'
|
23
|
+
|
24
|
+
client = BigDoor::Client.new( APP_SECRET, APP_KEY )
|
25
|
+
currency = BigDoor::Currency.new({
|
26
|
+
'pub_title' => 'Coins',
|
27
|
+
'pub_description' => 'an example of the Purchase currency type',
|
28
|
+
'end_user_title' => 'Coins',
|
29
|
+
'end_user_description' => 'can only be purchased',
|
30
|
+
'currency_type_id' => '1',
|
31
|
+
'currency_type_title' => 'Purchase',
|
32
|
+
'exchange_rate' => 900.00,
|
33
|
+
'relative_weight' => 2,
|
34
|
+
})
|
35
|
+
|
36
|
+
currency.save( client )
|
37
|
+
|
38
|
+
currency.load( client ) # reload object
|
39
|
+
|
40
|
+
currency.pub_title = 'Bank Notes'
|
41
|
+
currency.save( client ) # update object keeping same ID
|
42
|
+
|
43
|
+
currency_id = currency.resource_id
|
44
|
+
currency.load( client, currency_id) # load object by explictly defined id
|
45
|
+
|
46
|
+
nlc = BigDoor::NamedLevelCollection.new({
|
47
|
+
'pub_title' => 'Test Named Level Collection',
|
48
|
+
'pub_description' => 'test description',
|
49
|
+
'end_user_title' => 'test user title',
|
50
|
+
'end_user_description' => 'test user description',
|
51
|
+
'currency_id' => currency.resource_id,
|
52
|
+
})
|
53
|
+
|
54
|
+
nlc.save( client )
|
55
|
+
|
56
|
+
nl = BigDoor::NamedLevel.new({
|
57
|
+
'pub_title' => 'Named Level pub title',
|
58
|
+
'pub_description' => 'Named Level pub description',
|
59
|
+
'end_user_title' => 'Named Level end user title',
|
60
|
+
'end_user_description' => 'Named Level end user description',
|
61
|
+
'relative_weight' => 1,
|
62
|
+
'threshold' => 10,
|
63
|
+
'named_level_collection_id' => nlc.resource_id,
|
64
|
+
})
|
65
|
+
nl.save( client )
|
66
|
+
|
67
|
+
ntg = BigDoor::NamedTransactionGroup.new({
|
68
|
+
'pub_title' => 'Test Transaction Group',
|
69
|
+
'pub_description' => 'test description',
|
70
|
+
'end_user_title' => 'end user title',
|
71
|
+
'end_user_description' => 'end user description',
|
72
|
+
'end_user_cap' => '-1',
|
73
|
+
'end_user_cap_interval' => '-1',
|
74
|
+
})
|
75
|
+
ntg.save( client )
|
76
|
+
|
77
|
+
nt = BigDoor::NamedTransaction.new({
|
78
|
+
'pub_title' => 'Test Transaction',
|
79
|
+
'pub_description' => 'test description',
|
80
|
+
'end_user_title' => 'end user title',
|
81
|
+
'end_user_description' => 'end user description',
|
82
|
+
'currency_id' => currency.resource_id,
|
83
|
+
'amount' => '50',
|
84
|
+
'default_amount' => '50',
|
85
|
+
})
|
86
|
+
nt.save( client )
|
87
|
+
|
88
|
+
ntg.associate_with( nt, client, 1 )
|
89
|
+
|
90
|
+
username = (0...10).map{ ('a'..'z').to_a[rand(26)] }.join
|
91
|
+
|
92
|
+
end_user = BigDoor::EndUser.new({
|
93
|
+
'end_user_login' => username
|
94
|
+
})
|
95
|
+
end_user.save( client )
|
96
|
+
|
97
|
+
ntg.execute( username, { 'good_receiver' => username }, client )
|
98
|
+
|
99
|
+
# cleanup
|
100
|
+
currency.delete( client )
|
101
|
+
ntg.delete( client )
|
102
|
+
nt.delete( client )
|
103
|
+
nl.delete( client )
|
104
|
+
nlc.delete( client )
|
105
|
+
end_user.delete( client )
|
106
|
+
|
107
|
+
== REQUIREMENTS:
|
108
|
+
|
109
|
+
* rest-client
|
110
|
+
* uuidtools
|
111
|
+
* addressable
|
112
|
+
* json
|
113
|
+
|
114
|
+
== INSTALL:
|
115
|
+
|
116
|
+
The <code>bigdoorkit</code> is distributed as a RubyGem and is available
|
117
|
+
immediately after installation.
|
118
|
+
|
119
|
+
gem install bigdoorkit
|
120
|
+
|
121
|
+
Alternately, download the gem and install manually.
|
122
|
+
|
123
|
+
|
124
|
+
== TESTS:
|
125
|
+
|
126
|
+
Tests requre rspec 2.x and cucumber gems installed. To access BigDoor API you
|
127
|
+
need to get API keys ( see http://publisher.bigdoor.com/ site) - place them
|
128
|
+
into appropriate environment variable in you shell - BIGDOOR_API_KEY and
|
129
|
+
BIGDOOR_API_SECRET.
|
130
|
+
|
131
|
+
WARNING: Test suite was initially designed to be run against empty account
|
132
|
+
without any objects created (except predefined Attributes and CurrencyTypes)
|
133
|
+
and there is no checks for existing objects. While tests shouldn't touch or
|
134
|
+
remove any objects other than those they have created, there is still
|
135
|
+
possibility of bugs, so be careful running these tests against account with
|
136
|
+
live economy.
|
137
|
+
|
138
|
+
== LICENSE:
|
139
|
+
|
140
|
+
BigDoor Open License
|
141
|
+
Copyright (c) 2010 BigDoor Media, Inc.
|
142
|
+
|
143
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
144
|
+
of this software and associated documentation files (the "Software"), to deal
|
145
|
+
in the Software without restriction, including without limitation the rights to
|
146
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
147
|
+
of the Software, and to permit persons to whom the Software is furnished to
|
148
|
+
do so, subject to the following conditions:
|
149
|
+
|
150
|
+
- This copyright notice and all listed conditions and disclaimers shall
|
151
|
+
be included in all copies and portions of the Software including any
|
152
|
+
redistributions in binary form.
|
153
|
+
|
154
|
+
- The Software connects with the BigDoor API (api.bigdoor.com) and
|
155
|
+
all uses, copies, modifications, derivative works, mergers, publications,
|
156
|
+
distributions, sublicenses and sales shall also connect to the BigDoor API and
|
157
|
+
shall not be used to connect with any API, software or service that competes
|
158
|
+
with BigDoor's API, software and services.
|
159
|
+
|
160
|
+
- Except as contained in this notice, this license does not grant you rights to
|
161
|
+
use BigDoor Media, Inc. or any contributors' name, logo, or trademarks.
|
162
|
+
|
163
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
164
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
165
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
166
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
167
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
168
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
169
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
170
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'metric_fu'
|
6
|
+
require './lib/big_door'
|
7
|
+
|
8
|
+
Hoe.plugin :newgem
|
9
|
+
# Hoe.plugin :website
|
10
|
+
#Hoe.plugin :cucumberfeatures
|
11
|
+
|
12
|
+
# Generate all the Rake tasks
|
13
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
14
|
+
$hoe = Hoe.spec 'big_door' do
|
15
|
+
self.developer 'Alex L. Demidov', 'alexeydemidov@gmail.com'
|
16
|
+
# self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
17
|
+
# self.rubyforge_name = self.name # TODO this is default value
|
18
|
+
self.test_globs = ['spec/**/*.rb']
|
19
|
+
extra_deps << ['rest-client', '~> 1.0']
|
20
|
+
extra_deps << ['addressable', '~> 2.0']
|
21
|
+
extra_deps << ['json', '~> 1.0']
|
22
|
+
extra_deps << ['uuidtools', '~> 2.0']
|
23
|
+
extra_dev_deps << ['cucumber', '~> 0.10']
|
24
|
+
extra_dev_deps << ['rspec', '~> 2.4']
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'newgem/tasks'
|
28
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
29
|
+
|
30
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
31
|
+
# remove_task :default
|
32
|
+
# task :default => [:spec, :features]
|
@@ -0,0 +1 @@
|
|
1
|
+
Autotest.add_discovery { "rspec2" }
|
data/big_door.gemspec
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{big_door}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Alex L. Demidov"]
|
9
|
+
s.date = %q{2011-01-26}
|
10
|
+
s.default_executable = %q{example.rb}
|
11
|
+
s.description = %q{Client library for the BigDoor REST API (http://bigdoor.com). This package
|
12
|
+
provides both low-level procedural (BigDoor::Client) and object-oriented
|
13
|
+
(BigDoor::Resource object hierarchy) interfaces to BigDoor REST API.}
|
14
|
+
s.email = ["alexeydemidov@gmail.com"]
|
15
|
+
s.executables = ["example.rb"]
|
16
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
|
17
|
+
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "autotest/discover.rb", "big_door.gemspec", "bin/example.rb", "features/resources/attribute.feature", "features/resources/currency_type.feature", "features/resources/end_user.feature", "features/resources/named_award_collection.feature", "features/resources/named_good_collection.feature", "features/resources/named_level_collection.feature", "features/resources/url.feature", "features/step_definitions/resources_steps.rb", "features/support/env.rb", "lib/big_door.rb", "lib/big_door/attribute.rb", "lib/big_door/award.rb", "lib/big_door/client.rb", "lib/big_door/currency.rb", "lib/big_door/currency_balance.rb", "lib/big_door/currency_type.rb", "lib/big_door/end_user.rb", "lib/big_door/good.rb", "lib/big_door/leaderboard.rb", "lib/big_door/level.rb", "lib/big_door/named_award.rb", "lib/big_door/named_award_collection.rb", "lib/big_door/named_good.rb", "lib/big_door/named_good_collection.rb", "lib/big_door/named_level.rb", "lib/big_door/named_level_collection.rb", "lib/big_door/named_transaction.rb", "lib/big_door/named_transaction_group.rb", "lib/big_door/profile.rb", "lib/big_door/resource.rb", "lib/big_door/resource_end_user.rb", "lib/big_door/resource_with_association.rb", "lib/big_door/resource_with_parent.rb", "lib/big_door/url.rb", "script/console", "script/destroy", "script/generate", "spec/big_door/attribute_spec.rb", "spec/big_door/award_spec.rb", "spec/big_door/client_spec.rb", "spec/big_door/currency_balance_spec.rb", "spec/big_door/currency_spec.rb", "spec/big_door/currency_type_spec.rb", "spec/big_door/end_user_spec.rb", "spec/big_door/good_spec.rb", "spec/big_door/leaderboard_spec.rb", "spec/big_door/level_spec.rb", "spec/big_door/named_award_collection_spec.rb", "spec/big_door/named_award_spec.rb", "spec/big_door/named_good_collection_spec.rb", "spec/big_door/named_good_spec.rb", "spec/big_door/named_level_collection_spec.rb", "spec/big_door/named_level_spec.rb", "spec/big_door/named_transaction_group_spec.rb", "spec/big_door/named_transaction_spec.rb", "spec/big_door/profile_spec.rb", "spec/big_door/resource_end_user_spec.rb", "spec/big_door/resource_spec.rb", "spec/big_door/resource_with_association_spec.rb", "spec/big_door/resource_with_parent_spec.rb", "spec/big_door/url_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/cucumber.rake", "tasks/rspec.rake"]
|
18
|
+
s.homepage = %q{http://bitbucket.org/AlexeyDemidov/bigdoorkit-ruby/}
|
19
|
+
s.license = %q{restricted}
|
20
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
s.rubyforge_project = %q{big_door}
|
23
|
+
s.rubygems_version = %q{1.4.2}
|
24
|
+
s.summary = %q{Client library for the BigDoor REST API (http://bigdoor.com)}
|
25
|
+
s.test_files = ["spec/big_door/attribute_spec.rb", "spec/big_door/award_spec.rb", "spec/big_door/client_spec.rb", "spec/big_door/currency_balance_spec.rb", "spec/big_door/currency_spec.rb", "spec/big_door/currency_type_spec.rb", "spec/big_door/end_user_spec.rb", "spec/big_door/good_spec.rb", "spec/big_door/leaderboard_spec.rb", "spec/big_door/level_spec.rb", "spec/big_door/named_award_collection_spec.rb", "spec/big_door/named_award_spec.rb", "spec/big_door/named_good_collection_spec.rb", "spec/big_door/named_good_spec.rb", "spec/big_door/named_level_collection_spec.rb", "spec/big_door/named_level_spec.rb", "spec/big_door/named_transaction_group_spec.rb", "spec/big_door/named_transaction_spec.rb", "spec/big_door/profile_spec.rb", "spec/big_door/resource_end_user_spec.rb", "spec/big_door/resource_spec.rb", "spec/big_door/resource_with_association_spec.rb", "spec/big_door/resource_with_parent_spec.rb", "spec/big_door/url_spec.rb", "spec/spec_helper.rb"]
|
26
|
+
|
27
|
+
if s.respond_to? :specification_version then
|
28
|
+
s.specification_version = 3
|
29
|
+
|
30
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
31
|
+
s.add_runtime_dependency(%q<rest-client>, ["~> 1.0"])
|
32
|
+
s.add_runtime_dependency(%q<addressable>, ["~> 2.0"])
|
33
|
+
s.add_runtime_dependency(%q<json>, ["~> 1.0"])
|
34
|
+
s.add_runtime_dependency(%q<uuidtools>, ["~> 2.0"])
|
35
|
+
s.add_development_dependency(%q<cucumber>, ["~> 0.10"])
|
36
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.4"])
|
37
|
+
s.add_development_dependency(%q<hoe>, [">= 2.8.0"])
|
38
|
+
else
|
39
|
+
s.add_dependency(%q<rest-client>, ["~> 1.0"])
|
40
|
+
s.add_dependency(%q<addressable>, ["~> 2.0"])
|
41
|
+
s.add_dependency(%q<json>, ["~> 1.0"])
|
42
|
+
s.add_dependency(%q<uuidtools>, ["~> 2.0"])
|
43
|
+
s.add_dependency(%q<cucumber>, ["~> 0.10"])
|
44
|
+
s.add_dependency(%q<rspec>, ["~> 2.4"])
|
45
|
+
s.add_dependency(%q<hoe>, [">= 2.8.0"])
|
46
|
+
end
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<rest-client>, ["~> 1.0"])
|
49
|
+
s.add_dependency(%q<addressable>, ["~> 2.0"])
|
50
|
+
s.add_dependency(%q<json>, ["~> 1.0"])
|
51
|
+
s.add_dependency(%q<uuidtools>, ["~> 2.0"])
|
52
|
+
s.add_dependency(%q<cucumber>, ["~> 0.10"])
|
53
|
+
s.add_dependency(%q<rspec>, ["~> 2.4"])
|
54
|
+
s.add_dependency(%q<hoe>, [">= 2.8.0"])
|
55
|
+
end
|
56
|
+
end
|
data/bin/example.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'big_door'
|
6
|
+
require './lib/big_door.rb'
|
7
|
+
|
8
|
+
# see API Keys http://publisher.bigdoor.com/
|
9
|
+
APP_KEY = ENV['BIGDOOR_API_KEY']
|
10
|
+
APP_SECRET = ENV['BIGDOOR_API_SECRET']
|
11
|
+
|
12
|
+
client = BigDoor::Client.new( APP_SECRET, APP_KEY )
|
13
|
+
currency = BigDoor::Currency.new({
|
14
|
+
'pub_title' => 'Coins',
|
15
|
+
'pub_description' => 'an example of the Purchase currency type',
|
16
|
+
'end_user_title' => 'Coins',
|
17
|
+
'end_user_description' => 'can only be purchased',
|
18
|
+
'currency_type_id' => '1',
|
19
|
+
'currency_type_title' => 'Purchase',
|
20
|
+
'exchange_rate' => 900.00,
|
21
|
+
'relative_weight' => 2,
|
22
|
+
})
|
23
|
+
|
24
|
+
currency.save( client )
|
25
|
+
|
26
|
+
currency.load( client ) # reload object
|
27
|
+
|
28
|
+
currency.pub_title = 'Bank Notes'
|
29
|
+
currency.save( client ) # updates object keeping same ID
|
30
|
+
|
31
|
+
currency_id = currency.resource_id
|
32
|
+
currency.load( client, currency_id) # load object by explictly defined id
|
33
|
+
|
34
|
+
nlc = BigDoor::NamedLevelCollection.new({
|
35
|
+
'pub_title' => 'Test Named Level Collection',
|
36
|
+
'pub_description' => 'test description',
|
37
|
+
'end_user_title' => 'test user title',
|
38
|
+
'end_user_description' => 'test user description',
|
39
|
+
'currency_id' => currency.resource_id,
|
40
|
+
})
|
41
|
+
|
42
|
+
nlc.save( client )
|
43
|
+
|
44
|
+
nl = BigDoor::NamedLevel.new({
|
45
|
+
'pub_title' => 'Named Level pub title',
|
46
|
+
'pub_description' => 'Named Level pub description',
|
47
|
+
'end_user_title' => 'Named Level end user title',
|
48
|
+
'end_user_description' => 'Named Level end user description',
|
49
|
+
'relative_weight' => 1,
|
50
|
+
'threshold' => 10,
|
51
|
+
'named_level_collection_id' => nlc.resource_id,
|
52
|
+
})
|
53
|
+
nl.save( client )
|
54
|
+
|
55
|
+
ntg = BigDoor::NamedTransactionGroup.new({
|
56
|
+
'pub_title' => 'Test Transaction Group',
|
57
|
+
'pub_description' => 'test description',
|
58
|
+
'end_user_title' => 'end user title',
|
59
|
+
'end_user_description' => 'end user description',
|
60
|
+
'end_user_cap' => '-1',
|
61
|
+
'end_user_cap_interval' => '-1',
|
62
|
+
})
|
63
|
+
ntg.save( client )
|
64
|
+
|
65
|
+
nt = BigDoor::NamedTransaction.new({
|
66
|
+
'pub_title' => 'Test Transaction',
|
67
|
+
'pub_description' => 'test description',
|
68
|
+
'end_user_title' => 'end user title',
|
69
|
+
'end_user_description' => 'end user description',
|
70
|
+
'currency_id' => currency.resource_id,
|
71
|
+
'amount' => '50',
|
72
|
+
'default_amount' => '50',
|
73
|
+
})
|
74
|
+
nt.save( client )
|
75
|
+
|
76
|
+
ntg.associate_with( nt, client, 1 )
|
77
|
+
|
78
|
+
username = (0...10).map{ ('a'..'z').to_a[rand(26)] }.join
|
79
|
+
|
80
|
+
end_user = BigDoor::EndUser.new({
|
81
|
+
'end_user_login' => username
|
82
|
+
})
|
83
|
+
end_user.save( client )
|
84
|
+
|
85
|
+
ntg.execute( username, { 'good_receiver' => username }, client )
|
86
|
+
|
87
|
+
# cleanup
|
88
|
+
currency.delete( client )
|
89
|
+
ntg.delete( client )
|
90
|
+
nt.delete( client )
|
91
|
+
nl.delete( client )
|
92
|
+
nlc.delete( client )
|
93
|
+
end_user.delete( client )
|
@@ -0,0 +1,41 @@
|
|
1
|
+
@passing
|
2
|
+
Feature: attribute API endpoint
|
3
|
+
|
4
|
+
In order to operate with attribute objects
|
5
|
+
As object-oriented API client user
|
6
|
+
I want to use Attribute object
|
7
|
+
|
8
|
+
@remote
|
9
|
+
Scenario: get list of all Attribute
|
10
|
+
Given low-level client
|
11
|
+
When I call it to list all "Attribute" objects
|
12
|
+
Then I should get list of "Attribute" objects
|
13
|
+
|
14
|
+
@local
|
15
|
+
Scenario: create a new Attribute
|
16
|
+
Given low-level client
|
17
|
+
When I create a new "Attribute" object
|
18
|
+
Then I should get a "Attribute" object
|
19
|
+
|
20
|
+
@remote
|
21
|
+
Scenario: create and save a new Attribute
|
22
|
+
Given low-level client
|
23
|
+
When I create a new "Attribute" object
|
24
|
+
And assign "Attribute" data to object
|
25
|
+
And save object
|
26
|
+
Then I should get a "Attribute" object
|
27
|
+
And object should has resource_id defined
|
28
|
+
And I should be able to remove object
|
29
|
+
|
30
|
+
@remote
|
31
|
+
Scenario: create, save and associate a new Attribute with Currency
|
32
|
+
Given low-level client
|
33
|
+
And some Currency
|
34
|
+
When I create a new "Attribute" object
|
35
|
+
And assign "Attribute" data to object
|
36
|
+
And save object
|
37
|
+
And associate "Attribute" with "Currency"
|
38
|
+
Then I should get a "Attribute" object
|
39
|
+
And object should has resource_id defined
|
40
|
+
And I should be able to remove object
|
41
|
+
And Currency should be removed
|
@@ -0,0 +1,12 @@
|
|
1
|
+
@passing
|
2
|
+
Feature: currency_type API endpoint shows list of currency types
|
3
|
+
|
4
|
+
In order to known which currency types are available
|
5
|
+
As object-oriented API client user
|
6
|
+
I want to get list of currency types
|
7
|
+
|
8
|
+
@remote
|
9
|
+
Scenario:
|
10
|
+
Given low-level client
|
11
|
+
When I call it to list all "CurrencyType" objects
|
12
|
+
Then I should get list of "CurrencyType" objects
|
@@ -0,0 +1,92 @@
|
|
1
|
+
@passing
|
2
|
+
Feature: end_user API endpoint
|
3
|
+
|
4
|
+
In order to operate with end users objects
|
5
|
+
As object-oriented API client user
|
6
|
+
I want to use EndUser object
|
7
|
+
|
8
|
+
@remote @passing
|
9
|
+
Scenario: get list of all EndUser
|
10
|
+
Given low-level client
|
11
|
+
When I call it to list all "EndUser" objects
|
12
|
+
Then I should get list of "EndUser" objects
|
13
|
+
|
14
|
+
@local @passing
|
15
|
+
Scenario: create a new EndUser
|
16
|
+
Given low-level client
|
17
|
+
When I create a new "EndUser" object
|
18
|
+
Then I should get a "EndUser" object
|
19
|
+
|
20
|
+
@remote @passing
|
21
|
+
Scenario: create and save a new EndUser
|
22
|
+
Given low-level client
|
23
|
+
When I create and save a new "EndUser" object with "random" name
|
24
|
+
Then I should get a "EndUser" object
|
25
|
+
And I should be able to assign "Profile" to "EndUser"
|
26
|
+
And object should has guid defined
|
27
|
+
And I should be able to remove object
|
28
|
+
|
29
|
+
@remote @passing
|
30
|
+
Scenario: get CurrencyBalances for EndUsers
|
31
|
+
Given low-level client
|
32
|
+
And freshly created "EndUser" object with "random" name
|
33
|
+
When I call it to list all "CurrencyBalance" objects from "EndUser"
|
34
|
+
Then I should get list of all "0" "CurrencyBalance" objects
|
35
|
+
And "EndUser" object should be removed
|
36
|
+
|
37
|
+
@remote @passing
|
38
|
+
Scenario: Run Transaction for EndUser
|
39
|
+
Given low-level client
|
40
|
+
And freshly created "EndUser" object with "random" name
|
41
|
+
And some Currency
|
42
|
+
And some NamedTransactionGroup with some NamedTransaction
|
43
|
+
And some NamedLevelCollection with some NamedLevel
|
44
|
+
When I execute NamedTransactionGroup
|
45
|
+
And I call it to list all "CurrencyBalance" objects from "EndUser"
|
46
|
+
Then I should get list of all "1" "CurrencyBalance" objects
|
47
|
+
And I should see Leaderboard
|
48
|
+
And "EndUser" object should be removed
|
49
|
+
And "NamedTransactionGroup" should be removed
|
50
|
+
And "NamedLevelCollection" should be removed
|
51
|
+
And Currency should be removed
|
52
|
+
|
53
|
+
@remote @passing
|
54
|
+
Scenario: Run Transaction for EndUser with Level Up
|
55
|
+
Given low-level client
|
56
|
+
And freshly created "EndUser" object with "random" name
|
57
|
+
And some Currency
|
58
|
+
And some NamedTransactionGroup with some NamedTransaction
|
59
|
+
And some NamedLevelCollection with some NamedLevel
|
60
|
+
When I execute NamedTransactionGroup
|
61
|
+
And I call it to list all "Level" objects from "EndUser"
|
62
|
+
Then I should get list of all "1" "Level" objects
|
63
|
+
And "EndUser" object should be removed
|
64
|
+
And "NamedTransactionGroup" should be removed
|
65
|
+
And "NamedLevelCollection" should be removed
|
66
|
+
And Currency should be removed
|
67
|
+
|
68
|
+
@remote @passing
|
69
|
+
Scenario: Assign Award to EndUser
|
70
|
+
Given low-level client
|
71
|
+
And freshly created "EndUser" object with "random" name
|
72
|
+
And some NamedAwardCollection with some NamedAward
|
73
|
+
When I assign Award to EndUser
|
74
|
+
And I call it to list all "Award" objects from "EndUser"
|
75
|
+
Then I should get list of all "1" "Award" objects
|
76
|
+
And "EndUser" object should be removed
|
77
|
+
And "NamedAwardCollection" should be removed
|
78
|
+
|
79
|
+
@remote @passing
|
80
|
+
Scenario: Run Transaction for EndUser with Good
|
81
|
+
Given low-level client
|
82
|
+
And freshly created "EndUser" object with "random" name
|
83
|
+
And some Currency
|
84
|
+
And some NamedGoodCollection with some NamedGood
|
85
|
+
And some NamedTransactionGroup with some NamedTransaction with Good
|
86
|
+
When I execute NamedTransactionGroup
|
87
|
+
And I call it to list all "Good" objects from "EndUser"
|
88
|
+
Then I should get list of all "1" "Good" objects
|
89
|
+
And "EndUser" object should be removed
|
90
|
+
And "NamedGoodCollection" should be removed
|
91
|
+
And "NamedTransactionGroup" should be removed
|
92
|
+
And Currency should be removed
|
@@ -0,0 +1,42 @@
|
|
1
|
+
@passing
|
2
|
+
Feature: named_award_collection API endpoint
|
3
|
+
|
4
|
+
In order to operate with named award collections
|
5
|
+
As object-oriented API client user
|
6
|
+
I want to use NamedAwardCollection object
|
7
|
+
|
8
|
+
@remote
|
9
|
+
Scenario: get list of all NamedAwardCollections
|
10
|
+
Given low-level client
|
11
|
+
When I call it to list all "NamedAwardCollection" objects
|
12
|
+
Then I should get list of "NamedAwardCollection" objects
|
13
|
+
|
14
|
+
@local
|
15
|
+
Scenario: create a new NamedAwardCollection
|
16
|
+
Given low-level client
|
17
|
+
When I create a new "NamedAwardCollection" object
|
18
|
+
Then I should get a "NamedAwardCollection" object
|
19
|
+
|
20
|
+
@remote
|
21
|
+
Scenario: create and save a new NamedAwardCollection
|
22
|
+
Given low-level client
|
23
|
+
When I create a new "NamedAwardCollection" object
|
24
|
+
And assign some NamedAwardCollection data to object
|
25
|
+
And save object
|
26
|
+
And load object
|
27
|
+
And save object
|
28
|
+
Then I should get a "NamedAwardCollection" object
|
29
|
+
And object should has resource_id defined
|
30
|
+
And I should be able to remove object
|
31
|
+
|
32
|
+
@remote
|
33
|
+
Scenario: add NamedAward to NamedAwardCollection
|
34
|
+
Given low-level client
|
35
|
+
And new empty "NamedAwardCollection" collection
|
36
|
+
When I create a new "NamedAward" object
|
37
|
+
And assign NamedAward data to object
|
38
|
+
And save object
|
39
|
+
Then I should get a "NamedAward" object
|
40
|
+
And object should has resource_id defined
|
41
|
+
And I should be able to remove object
|
42
|
+
And collection should be removed too
|
@@ -0,0 +1,40 @@
|
|
1
|
+
@passing
|
2
|
+
Feature: named_good_collection API endpoint
|
3
|
+
|
4
|
+
In order to operate with named good collections
|
5
|
+
As object-oriented API client user
|
6
|
+
I want to use NamedGoodCollection object
|
7
|
+
|
8
|
+
@remote
|
9
|
+
Scenario: get list of all NamedGoodCollections
|
10
|
+
Given low-level client
|
11
|
+
When I call it to list all "NamedGoodCollection" objects
|
12
|
+
Then I should get list of "NamedGoodCollection" objects
|
13
|
+
|
14
|
+
@local
|
15
|
+
Scenario: create a new NamedGoodCollection
|
16
|
+
Given low-level client
|
17
|
+
When I create a new "NamedGoodCollection" object
|
18
|
+
Then I should get a "NamedGoodCollection" object
|
19
|
+
|
20
|
+
@remote
|
21
|
+
Scenario: create and save a new NamedGoodCollection
|
22
|
+
Given low-level client
|
23
|
+
When I create a new "NamedGoodCollection" object
|
24
|
+
And assign some NamedGoodCollection data to object
|
25
|
+
And save object
|
26
|
+
Then I should get a "NamedGoodCollection" object
|
27
|
+
And object should has resource_id defined
|
28
|
+
And I should be able to remove object
|
29
|
+
|
30
|
+
@remote
|
31
|
+
Scenario: add NamedGood to NamedGoodCollection
|
32
|
+
Given low-level client
|
33
|
+
And new empty NamedGoodCollection
|
34
|
+
When I create a new "NamedGood" object
|
35
|
+
And assign NamedGood data to object
|
36
|
+
And save object
|
37
|
+
Then I should get a "NamedGood" object
|
38
|
+
And object should has resource_id defined
|
39
|
+
And I should be able to remove object
|
40
|
+
And collection should be removed too
|