# Path: spacescout_web/views/reviews.py
# class ReviewsView(RESTDispatch):
#     def __init__(self):
#         consumer = oauth2.Consumer(
#             key=settings.SS_WEB_OAUTH_KEY,
#             secret=settings.SS_WEB_OAUTH_SECRET
#             )
#         self._client = oauth2.Client(consumer)
# 
#     def _url(self, spot_id):
#         return "{0}/api/v1/spot/{1}/reviews".format(
#                                             settings.SS_WEB_SERVER_HOST,
#                                             spot_id
#                                             )
# 
#     def POST(self, request, spot_id):
#         if not (request.user and request.user.is_authenticated()):
#             response = HttpResponse("User not authorized")
#             response.status_code = 401
#             return response
# 
#         headers = {
#             "X-OAuth-User": "%s" % request.user.username,
#             'Content-Type': 'application/json',
#             'Accept': 'application/json'
#         }
# 
#         resp, content = self._client.request(self._url(spot_id),
#                                              method='POST',
#                                              body=request.body,
#                                              headers=headers)
# 
#         if not (resp.status == 200 or resp.status == 201):
#             return HttpResponse('error', status=resp.status)
# 
#         return HttpResponse(
#                             "{}",
#                             mimetype='application/json',
#                             status=resp.status
#                             )
# 
#     @never_cache
#     def GET(self, request, spot_id):
# 
#         headers = {
#             'Content-Type': 'application/json',
#             'Accept': 'application/json'
#             }
# 
#         response_body = '{}'
# 
#         resp, content = self._client.request(
#                                             self._url(spot_id),
#                                             method='GET',
#                                             headers=headers
#                                             )
# 
#         if resp.status == 200 or resp.status == 201:
#             response_body = content if content else '{}'
#         else:
#             return HttpResponse('error', status=resp.status)
# 
#         return HttpResponse(
#                             response_body,
#                             mimetype='application/json',
#                             status=200
#                             )


from django.conf.urls import patterns, include, url
from django.conf import settings
from spacescout_web.views.reviews import ReviewsView
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

js_info_dict = {
    'packages': ('spacescout_web',),
}

urlpatterns = patterns(
    'spacescout_web.views',
    url(r'^$', 'home.HomeView'),
    url(r'^login$', 'auth.Prompt'),
    url(r'authenticate$', 'auth.Login'),
    url(r'^logout$', 'auth.Logout'),
    url(r'web_api/v1/user/me/favorites/?$', 'favorites.API'),
    url(r'web_api/v1/user/me/favorite/(?P<spot_id>\d+)$', 'favorites.API'),
    url(r'web_api/v1/directory/$', 'directory.API'),
    url(r'buildings$', 'buildings.buildings'),
    url(r'search/$', 'search.SearchView'),
    url(r'suggest/$', 'suggest.suggest', name="suggest-form"),
    url(r'suggest/thankyou/$', 'suggest.thank_you'),
    url(r'contact(?:/(?P<spot_id>\d+))?/$', 'contact.contact'),
    url(r'share/thankyou/$', 'share.thank_you'),
    url(r'share/sorry/$', 'share.sorry'),
    url(r'share/(?P<spot_id>\d+)$', 'share.share', name="share-form"),
    url(r'sorry(?:/(?P<spot_id>\d+))?/$', 'contact.sorry'),
    url(r'thankyou(?:/(?P<spot_id>\d+))?/$', 'contact.thank_you'),
    url(r'^favorites?$', 'favorites.FavoritesView'),

# Path: spacescout_web/views/reviews.py
# class ReviewsView(RESTDispatch):
#     def __init__(self):
#         consumer = oauth2.Consumer(
#             key=settings.SS_WEB_OAUTH_KEY,
#             secret=settings.SS_WEB_OAUTH_SECRET
#             )
#         self._client = oauth2.Client(consumer)
# 
#     def _url(self, spot_id):
#         return "{0}/api/v1/spot/{1}/reviews".format(
#                                             settings.SS_WEB_SERVER_HOST,
#                                             spot_id
#                                             )
# 
#     def POST(self, request, spot_id):
#         if not (request.user and request.user.is_authenticated()):
#             response = HttpResponse("User not authorized")
#             response.status_code = 401
#             return response
# 
#         headers = {
#             "X-OAuth-User": "%s" % request.user.username,
#             'Content-Type': 'application/json',
#             'Accept': 'application/json'
#         }
# 
#         resp, content = self._client.request(self._url(spot_id),
#                                              method='POST',
#                                              body=request.body,
#                                              headers=headers)
# 
#         if not (resp.status == 200 or resp.status == 201):
#             return HttpResponse('error', status=resp.status)
# 
#         return HttpResponse(
#                             "{}",
#                             mimetype='application/json',
#                             status=resp.status
#                             )
# 
#     @never_cache
#     def GET(self, request, spot_id):
# 
#         headers = {
#             'Content-Type': 'application/json',
#             'Accept': 'application/json'
#             }
# 
#         response_body = '{}'
# 
#         resp, content = self._client.request(
#                                             self._url(spot_id),
#                                             method='GET',
#                                             headers=headers
#                                             )
# 
#         if resp.status == 200 or resp.status == 201:
#             response_body = content if content else '{}'
#         else:
#             return HttpResponse('error', status=resp.status)
# 
#         return HttpResponse(
#                             response_body,
#                             mimetype='application/json',
#                             status=200
#                             )


# Path: spacescout_web/urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings
from spacescout_web.views.reviews import ReviewsView

    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

js_info_dict = {
    'packages': ('spacescout_web',),
}

urlpatterns = patterns(
    'spacescout_web.views',
    url(r'^$', 'home.HomeView'),
    url(r'^login$', 'auth.Prompt'),
    url(r'authenticate$', 'auth.Login'),
    url(r'^logout$', 'auth.Logout'),
    url(r'web_api/v1/user/me/favorites/?$', 'favorites.API'),
    url(r'web_api/v1/user/me/favorite/(?P<spot_id>\d+)$', 'favorites.API'),
    url(r'web_api/v1/directory/$', 'directory.API'),
    url(r'buildings$', 'buildings.buildings'),
    url(r'search/$', 'search.SearchView'),
    url(r'suggest/$', 'suggest.suggest', name="suggest-form"),
    url(r'suggest/thankyou/$', 'suggest.thank_you'),
    url(r'contact(?:/(?P<spot_id>\d+))?/$', 'contact.contact'),
    url(r'share/thankyou/$', 'share.thank_you'),
    url(r'share/sorry/$', 'share.sorry'),
    url(r'share/(?P<spot_id>\d+)$', 'share.share', name="share-form"),
    url(r'sorry(?:/(?P<spot_id>\d+))?/$', 'contact.sorry'),
    url(r'thankyou(?:/(?P<spot_id>\d+))?/$', 'contact.thank_you'),
    url(r'^favorites?$', 'favorites.FavoritesView'),

    url(r'space/(?P<spot_id>\d+)/reviews$', ReviewsView().run),