Permalink
Browse files

Made a few minor changes/improvements

Summary:
- Deleted the mixins in objects.py
- No longer fails when instantiating objects with int (instead of string)
- Removed CHANGES.txt (feels superfluous with releases in GH)

Test Plan: read
  • Loading branch information...
1 parent b80dc7f commit afcb3b387b4f5834719fb68c1393ca579d634883 Evan Chen committed Nov 11, 2014
Showing with 7 additions and 122 deletions.
  1. +0 −31 CHANGES.txt
  2. +2 −2 MANIFEST.in
  3. BIN examples/puget_sound.jpg
  4. BIN examples/test.png
  5. +5 −89 facebookads/objects.py
View
@@ -1,31 +0,0 @@
-2.2.0
-- CustomAudience object handles hashing emails or phone when adding users
-- Added support for ReachFrequencyPredictions
-- Added promoted_object field to AdSet
-- Moved all mixins to mixins.py
-- Removed comment from config.json.example
-
-0.2.3
-- Updated MANIFEST.in
-
-0.2.2
-- Fixed install regression caused by 0.2.1 README change
-
-0.2.1
-- Fixed setup.py accounting for wrong README
-
-0.2.0
-- Added ObjectStorySpec and specs module
-- Moved integration tests to their own file
-- Added ValidatesFields mixin
-- Added bootstrap.auth() function to make using REPL easier
-- Deprecated remote_create_with_filename
-- Deprecated AbstractObject child method
-- Renamed _read_update() to _set_data()
-
-0.1.1
-- Increase version requirement for required configparser package (Python 3 compatibility fix)
-- Misc issue fix requests
-
-0.1.0
-Initial release.
View
@@ -1,3 +1,3 @@
include *.txt *.md *.py
-recursive-include examples *.jpg *.py *.dist
-recursive-include facebookads *.py *.crt *.jpg
+recursive-include examples *.png *.py *.dist
+recursive-include facebookads *.py *.crt *.png
View
Deleted file not rendered
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -294,9 +294,10 @@ def __init__(self, fbid=None, parent_id=None, api=None):
self._changes = {}
if fbid is not None:
- self[self.__class__.Field.id] = fbid
+ self[self.__class__.Field.id] = str(fbid)
- self.parent_id = parent_id
+ if parent_id is not None:
+ self.parent_id = str(parent_id)
self.api = api
def __setitem__(self, key, value):
@@ -745,42 +746,6 @@ def edge_object(self, target_objects_class, fields=None, params=None):
return None
-class CannotCreate(object):
-
- """
- An instance of CannotCreate will raise a TypeError when calling
- remote_create().
- """
-
- @classmethod
- def remote_create(cls, *args, **kwargs):
- raise TypeError('Cannot create object of type %s.' % cls.__name__)
-
-
-class CannotDelete(object):
-
- """
- An instance of CannotDelete will raise a TypeError when calling
- remote_delete().
- """
-
- @classmethod
- def remote_delete(cls, *args, **kwargs):
- raise TypeError('Cannot delete object of type %s.' % cls.__name__)
-
-
-class CannotUpdate(object):
-
- """
- An instance of CannotUpdate will raise a TypeError when calling
- remote_update().
- """
-
- @classmethod
- def remote_update(cls, *args, **kwargs):
- raise TypeError('Cannot update object of type %s.' % cls.__name__)
-
-
class AdUser(CannotCreate, CannotDelete, CannotUpdate, AbstractCrudObject):
"""
@@ -1120,41 +1085,6 @@ def get_ad_user(self):
return AdUser(fbid=self[self.__class__.Field.uid])
-class HasObjective(object):
-
- """
- An instance of HasObjective will have an enum attribute Objective.
- """
-
- class Objective(object):
- canvas_app_engagement = 'CANVAS_APP_ENGAGEMENT'
- canvas_app_installs = 'CANVAS_APP_INSTALLS'
- event_responses = 'EVENT_RESPONSES'
- local_awareness = 'LOCAL_AWARENESS'
- mobile_app_engagement = 'MOBILE_APP_ENGAGEMENT'
- mobile_app_installs = 'MOBILE_APP_INSTALLS'
- none = 'NONE'
- offer_claims = 'OFFER_CLAIMS'
- page_likes = 'PAGE_LIKES'
- post_engagement = 'POST_ENGAGEMENT'
- website_clicks = 'WEBSITE_CLICKS'
- website_conversions = 'WEBSITE_CONVERSIONS'
- video_views = 'VIDEO_VIEWS'
-
-
-class HasStatus(object):
-
- """
- An instance of HasStatus will have an enum attribute Status.
- """
-
- class Status(object):
- active = 'ACTIVE'
- archived = 'ARCHIVED'
- deleted = 'DELETED'
- paused = 'PAUSED'
-
-
class AdCampaign(HasStatus, HasObjective, AbstractCrudObject):
class Field(object):
@@ -1188,20 +1118,6 @@ def get_stats(self, fields=None, params=None):
return self.iterate_edge(AdStats, fields, params)
-class HasBidInfo(object):
-
- """
- An instance of HasBidInfo will have an enum attribute BidInfo.
- """
-
- class BidInfo(object):
- actions = 'ACTIONS'
- clicks = 'CLICKS'
- impressions = 'IMPRESSIONS'
- reach = 'REACH'
- social = 'SOCIAL'
-
-
class AdSet(HasStatus, AbstractCrudObject):
class Field(HasBidInfo, object):
@@ -1845,8 +1761,8 @@ def reserve(
def cancel(self):
params = {
- self.__class__.Field.prediction_id: self.get_id_assured(),
- self.__class__.Field.action: self.__class__.Action.cancel,
+ self.Field.prediction_id: self.get_id_assured(),
+ self.Field.action: self.__class__.Action.cancel,
}
self.get_api_assured().call(
FacebookAdsApi.HTTP_METHOD_POST,

0 comments on commit afcb3b3

Please sign in to comment.