Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Restructuralization
Browse files Browse the repository at this point in the history
  • Loading branch information
michalwiglasz committed Apr 14, 2014
1 parent ef7a3ef commit ef6c6fc
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 85 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
*.egg-info
.env
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
install_requires=[],
tests_require=[],
include_package_data=True,
test_suite="tests",
)
23 changes: 0 additions & 23 deletions sklikapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@

from config import Config
from client import Client
from errors import SklikApiError
from methods.methods import Missing
from methods.admethods import Ad, AdStat
from methods.campaignmethods import Campaign, CampaignRegionPolygonVertex, \
CampaignRegion, CampaignStat
from methods.conversionmethods import Conversion, ConversionType
from methods.groupmethods import Group, GroupStat
from methods.keywordmethods import Keyword, KeywordStat
from methods.miscmethods import SearchService

__all__ = [
"Config", "Client", "SklikApiError", "Missing",
"Ad", "AdStat",
"Campaign", "CampaignRegionPolygonVertex", "CampaignRegion", "CampaignStat",
"Conversion", "ConversionType",
"Group", "GroupStat",
"Keyword", "KeywordStat",
"SearchService",
]

23 changes: 23 additions & 0 deletions sklikapi/bajaja/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

from config import Config
from client import Client
from errors import SklikApiError
from methods.methods import Missing
from methods.admethods import Ad, AdStat
from methods.campaignmethods import Campaign, CampaignRegionPolygonVertex, \
CampaignRegion, CampaignStat
from methods.conversionmethods import Conversion, ConversionType
from methods.groupmethods import Group, GroupStat
from methods.keywordmethods import Keyword, KeywordStat
from methods.miscmethods import SearchService

__all__ = [
"Config", "Client", "SklikApiError", "Missing",
"Ad", "AdStat",
"Campaign", "CampaignRegionPolygonVertex", "CampaignRegion", "CampaignStat",
"Conversion", "ConversionType",
"Group", "GroupStat",
"Keyword", "KeywordStat",
"SearchService",
]

File renamed without changes.
File renamed without changes.
60 changes: 20 additions & 40 deletions sklikapi/errors.py → sklikapi/bajaja/errors.py
Original file line number Diff line number Diff line change
@@ -1,92 +1,72 @@

class SklikApiError(Exception):
"""Base Sklik API error exception class
"""

"""Base Sklik API error exception"""
pass
#endclass


class SklikApiWarning(Warning):
"""Base Sklik API warning exception class
"""
"""Base Sklik API warning exception"""
pass


class IncompatibleApiVersionError(SklikApiError):
"""Sklik API has incompatible version error exception"""
pass
#endclass

class NotFoundError(SklikApiError):
"""Sklik API not found error exception
"""

class NotFoundError(SklikApiError):
"""Sklik API not found error exception"""
pass
#endclass


class ArgumentError(SklikApiError):
"""Sklik API argument error exception
"""
"""Sklik API argument error exception"""

__slots__ = ["__errors"]

def __init__(self, message, errors):
SklikApiError.__init__(self, message)
self.__errors = errors
#enddef

def errors(self):
return self.__errors
#enddef

def __str__(self):
s = super(ArgumentError, self).__str__()
return '; '.join([s] + self.__errors)
#enddef

#endclass

class InvalidDataError(SklikApiError):
"""Sklik API invalid data error exception
"""
"""Sklik API invalid data error exception"""

__slots__ = ["__errors"]

def __init__(self, message, errors):
SklikApiError.__init__(self, message)
self.__errors = errors
#enddef

def errors(self):
return self.__errors
#enddef

def __str__(self):
s = super(InvalidDataError, self).__str__()
return '; '.join([s] + [e['id'] for e in self.__errors])
#enddef
#endclass

class AuthenticationError(SklikApiError):
"""Sklik API authentication error exception
"""

class AuthenticationError(SklikApiError):
"""Sklik API authentication error exception"""
pass
#endclass

class SessionError(SklikApiError):
"""Sklik API session error exception
"""

class SessionError(SklikApiError):
"""Sklik API session error exception"""
pass
#endclass

class AccessError(SklikApiError):
"""Skik API access error exception
"""

class AccessError(SklikApiError):
"""Skik API access error exception"""
pass
#endclass

class NoActionWarning(SklikApiWarning):
"""Sklik API no action error exception
"""

class NoActionWarning(SklikApiWarning):
"""Sklik API no action error exception"""
pass
#endclass
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,18 @@ class Ad(object):
"""Ad class
Attributes:
id: ad ID
creative1: ad title
creative2: ad line 1
creative3: ad line 2
clickthruUrl: destination URL
clickthruText: visible URL
removed: whether is removed
status: ad status
created: creation date
groupId: group ID
"""

__slots__ = [
"id",
"creative1",
Expand All @@ -42,27 +33,20 @@ class Ad(object):
def __init__(self):
for attr in self.__slots__:
setattr(self, attr, Missing)
#endfor
#enddef
#endclass


class AdStat(object):
"""Ad stat class
Attributes:
conversions: conversion count
transactions: transaction count
money: money sum
avgPosition: average position
impressions: impression count
clicks: click count
"""

__slots__ = [
"conversions",
"transactions",
Expand All @@ -79,12 +63,11 @@ def __init__(self):
self.avgPosition = 0
self.impressions = 0
self.clicks = 0
#enddef
#endclass


class AdMethods(Methods):
@convert(Ad)
def checkAd(self, attributes):
def check_ad(self, attributes):
"""Checks ad attributes
Arguments:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ef6c6fc

Please sign in to comment.