stackmob 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +175 -0
- data/README.md +210 -0
- data/Rakefile +59 -0
- data/VERSION +1 -0
- data/lib/stackmob.rb +67 -0
- data/lib/stackmob/client.rb +90 -0
- data/lib/stackmob/data_store.rb +74 -0
- data/lib/stackmob/deployer.rb +37 -0
- data/lib/stackmob/helpers.rb +63 -0
- data/lib/stackmob/push.rb +63 -0
- data/lib/stackmob/rack/simple_oauth_provider.rb +59 -0
- data/lib/stackmob/rails.rb +15 -0
- data/lib/stackmob/railtie.rb +38 -0
- data/lib/stackmob/sinatra.rb +5 -0
- data/lib/stackmob/tasks.rb +40 -0
- data/stackmob.gemspec +99 -0
- data/test/helper.rb +22 -0
- data/test/integration/test_client.rb +45 -0
- data/test/integration/test_data_store.rb +31 -0
- data/test/integration/test_deployer.rb +23 -0
- data/test/integration/test_push.rb +24 -0
- data/test/integration_helper.rb +46 -0
- data/test/unit/stackmob/rack/test_simple_oauth_provider.rb +52 -0
- data/test/unit/stackmob/test_client.rb +105 -0
- data/test/unit/stackmob/test_data_store.rb +83 -0
- data/test/unit/stackmob/test_deployer.rb +21 -0
- data/test/unit/stackmob/test_push.rb +133 -0
- metadata +258 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "oauth", "~> 0.4.5"
|
4
|
+
gem "yajl-ruby", "~> 0.8.2", :require => "yajl"
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem "minitest", ">= 0"
|
8
|
+
gem "yard", "~> 0.6.0"
|
9
|
+
gem "cucumber", ">= 0"
|
10
|
+
gem "bundler", "~> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.6.4"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
gem "mocha", ">= 0"
|
14
|
+
gem "rack-test"
|
15
|
+
gem "bluecloth"
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
bluecloth (2.1.0)
|
5
|
+
builder (3.0.0)
|
6
|
+
cucumber (1.0.2)
|
7
|
+
builder (>= 2.1.2)
|
8
|
+
diff-lcs (>= 1.1.2)
|
9
|
+
gherkin (~> 2.4.5)
|
10
|
+
json (>= 1.4.6)
|
11
|
+
term-ansicolor (>= 1.0.5)
|
12
|
+
diff-lcs (1.1.2)
|
13
|
+
gherkin (2.4.5)
|
14
|
+
json (>= 1.4.6)
|
15
|
+
git (1.2.5)
|
16
|
+
jeweler (1.6.4)
|
17
|
+
bundler (~> 1.0)
|
18
|
+
git (>= 1.2.5)
|
19
|
+
rake
|
20
|
+
json (1.5.3)
|
21
|
+
minitest (2.3.1)
|
22
|
+
mocha (0.9.12)
|
23
|
+
oauth (0.4.5)
|
24
|
+
rack (1.3.2)
|
25
|
+
rack-test (0.6.1)
|
26
|
+
rack (>= 1.0)
|
27
|
+
rake (0.9.2)
|
28
|
+
rcov (0.9.9)
|
29
|
+
term-ansicolor (1.0.6)
|
30
|
+
yajl-ruby (0.8.2)
|
31
|
+
yard (0.6.8)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
bluecloth
|
38
|
+
bundler (~> 1.0.0)
|
39
|
+
cucumber
|
40
|
+
jeweler (~> 1.6.4)
|
41
|
+
minitest
|
42
|
+
mocha
|
43
|
+
oauth (~> 0.4.5)
|
44
|
+
rack-test
|
45
|
+
rcov
|
46
|
+
yajl-ruby (~> 0.8.2)
|
47
|
+
yard (~> 0.6.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
data/README.md
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
# StackMob
|
2
|
+
|
3
|
+
This gem is meant to be used along with the StackMob add-on for Heroku. Using this gem you can run your StackMob application's custom code on Heroku using Rails 3 & Sinatra (Rails 2.3.x Support Coming Soon).
|
4
|
+
|
5
|
+
## Adding StackMob to your Rails 3 Application
|
6
|
+
|
7
|
+
Add the following to your Gemfile and run `bundle install`:
|
8
|
+
|
9
|
+
gem "stackmob", :require => "stackmob/rails"
|
10
|
+
|
11
|
+
## Configuring Your Application
|
12
|
+
|
13
|
+
The gem requires a few configuration details that need to be added to the file `config/stackmob.yml`. You will need the name of the application you created, as well as your public and private keys for both development (sandbox) and production from the StackMob add-on dashboard.
|
14
|
+
|
15
|
+
# example config/stackmob.yml
|
16
|
+
sm_app_name: StackMob App Name
|
17
|
+
sm_client_name: Your StackMob Client Name
|
18
|
+
heroku_app_name: Heroku App Name
|
19
|
+
|
20
|
+
development:
|
21
|
+
key: Your StackMob Sandbox Public Key
|
22
|
+
secret: Your StackMob Sandbox Private Key
|
23
|
+
|
24
|
+
production:
|
25
|
+
key: Your StackMob Production Public Key
|
26
|
+
secret: Your StackMob Production Private Key
|
27
|
+
|
28
|
+
Additionally, you will want to include some helpful methods in your controllers. Add the line below to the `ApplicationController`. Check out "Interacting With Your API in Your Application" for more details about the methods provided by StackMob::Helpers.
|
29
|
+
|
30
|
+
include StackMob::Helpers
|
31
|
+
|
32
|
+
## Interacting with CRUD from the Console
|
33
|
+
|
34
|
+
Once the gem is added to your application & configured you can take things for a test drive. You'll need to grab your public & private sandbox keys from the StackMob add-on page within the Heroku dashboard. Once you have those run `rails console`. All of the classes you will use in your application function using a class called `StackMob::Client`. You will not be exposed to this class in your controllers but to test in the console you will need to create an instance:
|
35
|
+
|
36
|
+
>> stackmob_client = StackMob::Client.new(StackMob.dev_url, StackMob.app_name, StackMob::SANDBOX, StackMob.key, StackMob.secret)
|
37
|
+
=> #<StackMob::Client:0x007fae99839cb8 @app_name= ...>
|
38
|
+
|
39
|
+
Although you can use the `StackMob::Client` to interact with the CRUD methods of your API, you will be using `StackMob::DataStore` in your application, which provides a much simpler interface to perform operations.
|
40
|
+
|
41
|
+
>> datastore = StackMob::DataStore.new(stackmob_client)
|
42
|
+
=> #<StackMob::DataStore:0x007fae991eebd8 ...>
|
43
|
+
|
44
|
+
The simplest operation to perform is to list the application's schema:
|
45
|
+
|
46
|
+
>> datastore.api_schema
|
47
|
+
=> {"user"=>{"properties"=>{"username"=> ...
|
48
|
+
|
49
|
+
To fetch all records for an object use `StackMob::DatStore#get`:
|
50
|
+
|
51
|
+
>> datastore.get(:user)
|
52
|
+
=> [{"username"=>"Some User", "lastmoddate"=>1312996693261, ...
|
53
|
+
|
54
|
+
Fetch a single record using `StackMob::DataStore#get_one`:
|
55
|
+
|
56
|
+
>> datastore.get_one(:user, :username => "Some User")
|
57
|
+
=> {"username"=>"Some User", "lastmoddate"=>1312996693261, ...
|
58
|
+
|
59
|
+
>> datastore.get_one(:user, :username => "D.N.E")
|
60
|
+
=> nil
|
61
|
+
|
62
|
+
Create and update records:
|
63
|
+
|
64
|
+
>> datastore.create(:user, :username => "newuser", :name => "First Last")
|
65
|
+
=> true
|
66
|
+
|
67
|
+
>> datastore.update(:user, "newuser", :name => "New Name")
|
68
|
+
=> true
|
69
|
+
|
70
|
+
|
71
|
+
Delete records
|
72
|
+
|
73
|
+
>> datastore.delete(:user, :username => "newuser")
|
74
|
+
=> true
|
75
|
+
|
76
|
+
## Interacting With Your API in Your Application
|
77
|
+
|
78
|
+
When you include `StackMob::Helpers` in your `ApplicationController` you get a couple of convenience methods to use in your controller actions. `sm_datastore` and `sm_push` provide per-request instances of `StackMob::DataStore` & `StackMob::Push` (for more information on Push see "Sending Push Messages from your Application"). An example action, which returns a list of usernames for each user object record is below:
|
79
|
+
|
80
|
+
class MyController < ApplicationController
|
81
|
+
|
82
|
+
def username_list
|
83
|
+
users = sm_datastore.get(:user)
|
84
|
+
|
85
|
+
render :json => { :usernames => usernames.map { |u| u['username'] }
|
86
|
+
|
87
|
+
rescue StackMob::Client::RequestError # something went wrong making the request
|
88
|
+
render :json => {"error": "could not communicate with StackMob Servers"}
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
### Sending Push Messages from your Application
|
94
|
+
|
95
|
+
`StackMob::Push` allows you to interact with the Push Notification portion of your StackMob API. The examples below show how to register a device token, send a message to a single user or device token and how to send a broadcast message to all users.
|
96
|
+
|
97
|
+
# Register a User With His/Her Device Token in your Controller
|
98
|
+
sm_push.register("user_id", "user_device_token")
|
99
|
+
|
100
|
+
# Send a Push Message to a User using Device Token
|
101
|
+
sm_push.send_message("user_device_token", :sound => "yoursoundfile.mp3", :alert => "The Message to Show the User", :badge => 2)
|
102
|
+
|
103
|
+
# Send a Push Message to a User using the User Object's Primary Key
|
104
|
+
sm_push.send_message("primary_key_value", :sound => "yoursendfile.mp3", :alert => "Message", :badge => 0, :recipients_are_users => true)
|
105
|
+
|
106
|
+
# Broadcast a Message
|
107
|
+
sm_push.broadcast(:badge => 1, :sound => "audiofile.mp3", :alert => "The Broadcasted Message")
|
108
|
+
|
109
|
+
Only the `:alert` key is required when sending or broadcasting messages.
|
110
|
+
|
111
|
+
## Using Sinatra
|
112
|
+
|
113
|
+
You can also write your application using Sinatra. Create a Gemfile like the one below and run `bundle install`. You also need to create a `config/stackmob.yml` like the one above.
|
114
|
+
|
115
|
+
source 'http://rubygems.org'
|
116
|
+
|
117
|
+
gem 'sinatra'
|
118
|
+
gem 'stackmob', :require => 'stackmob/sinatra'
|
119
|
+
|
120
|
+
In your `config.ru` file add the following line:
|
121
|
+
|
122
|
+
use StackMob::Rack::SimpleOAuthProvider
|
123
|
+
|
124
|
+
To use the `StackMob::Helpers` module in a classic Sinatra application:
|
125
|
+
|
126
|
+
require 'bundler/setup'
|
127
|
+
|
128
|
+
require 'sinatra'
|
129
|
+
require 'stackmob/sinatra'
|
130
|
+
|
131
|
+
before do
|
132
|
+
content_type :json # your responses should always return a JSON content type
|
133
|
+
end
|
134
|
+
|
135
|
+
...
|
136
|
+
|
137
|
+
To use it in a modular application:
|
138
|
+
|
139
|
+
require 'bundler/setup'
|
140
|
+
|
141
|
+
require 'sinatra/base'
|
142
|
+
require 'stackmob/sinatra'
|
143
|
+
|
144
|
+
class MyApp < Sinatra::Base
|
145
|
+
helpers StackMob::Helpers
|
146
|
+
|
147
|
+
...
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
### Adding Rake Tasks to a Sinatra Application
|
152
|
+
|
153
|
+
Add the following lines to your Rakefile in order to add the `stackmob:deploy` task.
|
154
|
+
|
155
|
+
require 'bundler/setup' # add this line if its not already included in your Rakefile
|
156
|
+
require 'stackmob/tasks'
|
157
|
+
|
158
|
+
## Deploying
|
159
|
+
|
160
|
+
In order to deploy your Rails application you will first need to deploy your StackMob API to production. To do so, go to the StackMob add-on page, click the deploy tab, and select "Deploy to Live API". Once on the deployment page, select "Create from Sandbox" for which snapshot to deploy and "API Version 1" for which version to deploy to. Add any comments in the deploy notes field and click deploy.
|
161
|
+
|
162
|
+
Deploying your Heroku application only requires one additional step. After you have pushed your changes to Heroku you will need to run:
|
163
|
+
|
164
|
+
heroku run rake stackmob:deploy
|
165
|
+
|
166
|
+
This rake task will inform the StackMob servers that you have deployed a new version of your application as well as update any information that may be needed to proxy requests to your application.
|
167
|
+
|
168
|
+
## Running your Application Locally in Development
|
169
|
+
|
170
|
+
The railtie provided with this gem adds a simple oauth provider into the middleware stack. When making requests to your Rails or Sinatra application while its running locally you can either use the oauth gem, installed as a dependency to this one, with your public/private development keys in `config/stackmob.yml` or add the line `no_oauth: true` under the development section of the same config file. Adding the `no_oauth: true` line to `config/stackmob.yml` will only prevent verification of oauth keys locally. It will not turn off the middleware in production even if the option is specified under the production section of the config file.
|
171
|
+
|
172
|
+
## Contributing to stackmob gem
|
173
|
+
|
174
|
+
The stackmob Ruby Gem is Apache 2.0 licensed (see LICENSE.txt) and we look forward to your contributions.
|
175
|
+
|
176
|
+
### Reporting Bugs
|
177
|
+
|
178
|
+
We are using [GitHub Issues](https://github.com/stackmob/stackmob-ruby/issues) to track feature requests and bugs.
|
179
|
+
|
180
|
+
### Running the Tests
|
181
|
+
|
182
|
+
Before submitting a pull request add any appropriate tests and run them along with the existing ones. The gem includes tasks to run unit & integration tests seperately or together. Before running the integration tests you will need to setup a few things. First, create a new application on your StackMob account named "test". In the new application, create a User Object named "user", with one extra string field, "name". Finally, you will have to set a few environment variables. If your using RVM, a good place to put these is your .rvmrc file.
|
183
|
+
|
184
|
+
export STACKMOB_TEST_URL="YOURDOMAIN.stackmob.com"
|
185
|
+
export STACKMOB_TEST_KEY="YOUR TEST APP PUB KEY"
|
186
|
+
export STACKMOB_TEST_SECRET="YOUR TEST APP PRIV KEY"
|
187
|
+
|
188
|
+
You can run the tests with one of these three Rake tasks:
|
189
|
+
|
190
|
+
rake test:all
|
191
|
+
rake test:unit
|
192
|
+
rake test:integration
|
193
|
+
|
194
|
+
## Copyright
|
195
|
+
|
196
|
+
Copyright 2011 StackMob
|
197
|
+
|
198
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
199
|
+
you may not use this file except in compliance with the License.
|
200
|
+
You may obtain a copy of the License at
|
201
|
+
|
202
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
203
|
+
|
204
|
+
Unless required by applicable law or agreed to in writing, software
|
205
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
206
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
207
|
+
See the License for the specific language governing permissions and
|
208
|
+
limitations under the License.
|
209
|
+
|
210
|
+
|