示例#1
0
 class Meta(MarketplaceModelResource.Meta):
     always_return_data = True
     authentication = (SharedSecretAuthentication(), OAuthAuthentication())
     authorization = OwnerAuthorization()
     detail_allowed_methods = ['get']
     queryset = Contribution.objects.filter(type=amo.CONTRIB_PURCHASE)
     resource_name = 'status'
示例#2
0
 class Meta(AppResource.Meta):
     authentication = (SharedSecretAuthentication(), OAuthAuthentication())
     authorization = OwnerAuthorization()
     detail_allowed_methods = []
     list_allowed_methods = ['get']
     resource_name = 'installed/mine'
     slug_lookup = None
示例#3
0
 class Meta(MarketplaceModelResource.Meta):
     authentication = (SharedSecretAuthentication(), OAuthAuthentication())
     authorization = OwnerAuthorization()
     detail_allowed_methods = ['get', 'patch', 'put']
     fields = ['display_name']
     list_allowed_methods = []
     queryset = UserProfile.objects.filter()
     resource_name = 'settings'
示例#4
0
 class Meta(MarketplaceModelResource.Meta):
     authentication = (SharedSecretAuthentication(), OAuthAuthentication())
     authorization = OwnerAuthorization()
     detail_allowed_methods = ['get']
     list_allowed_methods = []
     fields = ['resource_uri']
     queryset = UserProfile.objects.filter()
     resource_name = 'permissions'
示例#5
0
 class Meta(MarketplaceResource.Meta):
     always_return_data = True
     authentication = (SharedSecretAuthentication(), OAuthAuthentication())
     authorization = Authorization()
     detail_allowed_methods = []
     list_allowed_methods = ['post']
     object_class = GenericObject
     resource_name = 'prepare'
     validation = CleanedDataFormValidation(form_class=PrepareForm)
示例#6
0
 class Meta(MarketplaceResource.Meta):
     always_return_data = True
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     authorization = Authorization()
     detail_allowed_methods = []
     list_allowed_methods = ['post']
     object_class = dict
     resource_name = 'install'
示例#7
0
 class Meta(MarketplaceModelResource.Meta):
     queryset = ReviewFlag.objects.all()
     resource_name = 'rating_flag'
     list_allowed_methods = ['post']
     detail_allowed_methods = []
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     authorization = Authorization()
     fields = ['review', 'flag', 'note', 'user']
示例#8
0
 class Meta(AppResource.Meta):
     resource_name = 'search'
     allowed_methods = []
     detail_allowed_methods = []
     list_allowed_methods = ['get']
     authorization = ReadOnlyAuthorization()
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     slug_lookup = None
     # Override CacheThrottle with a no-op.
     throttle = BaseThrottle()
示例#9
0
 class Meta:
     resource_name = 'search'
     allowed_methods = []
     detail_allowed_methods = []
     list_allowed_methods = ['get']
     authorization = ReadOnlyAuthorization()
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     slug_lookup = None
     queryset = Webapp.objects.all()  # Gets overriden in dispatch.
     fields = ['categories', 'description', 'device_types', 'homepage',
               'id', 'name', 'payment_account', 'premium_type',
               'status', 'support_email', 'support_url']
     always_return_data = True
     serializer = Serializer(formats=['json'])
示例#10
0
 class Meta(MarketplaceModelResource.Meta):
     queryset = Webapp.objects.all()  # Gets overriden in dispatch.
     fields = ['categories', 'description', 'device_types', 'homepage',
               'id', 'name', 'payment_account', 'premium_type',
               'status', 'support_email', 'support_url']
     list_allowed_methods = ['get', 'post']
     detail_allowed_methods = ['get', 'put', 'delete']
     always_return_data = True
     authentication = (SharedSecretAuthentication(),
                       OptionalOAuthAuthentication())
     authorization = AppOwnerAuthorization()
     resource_name = 'app'
     serializer = Serializer(formats=['json'])
     slug_lookup = 'app_slug'
     # Throttle users without Apps:APIUnthrottled at 10 POST requests/day.
     throttle = CacheThrottle(throttle_at=10, timeframe=60 * 60 * 24)
示例#11
0
    class Meta:
        # Unfortunately, the model class name for ratings is "Review".
        queryset = Review.objects.valid()
        resource_name = 'rating'
        list_allowed_methods = ['get', 'post']
        detail_allowed_methods = ['get', 'put', 'delete']
        always_return_data = True
        authentication = (SharedSecretAuthentication(),
                          OptionalOAuthAuthentication())
        authorization = AnonymousReadOnlyAuthorization()
        fields = ['rating', 'body']

        filtering = {
            'app': ('exact', ),
            'user': ('exact', ),
            'pk': ('exact', ),
        }

        ordering = ['created']
示例#12
0
 class Meta(MarketplaceResource.Meta):
     list_allowed_methods = ['post']
     detail_allowed_methods = []
     resource_name = 'newsletter'
     authorization = Authorization()
     authentication = (SharedSecretAuthentication(), OAuthAuthentication())