This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,150 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* Decide on convents about when to raise and when to return true/false | ||
|
||
So far I've kind of taken the stance if we're retrieving a list and there | ||
are only two possible failures (APIKey or primary key) to raise if there | ||
is an error but for update/save/create operations to return true/false | ||
and then let the user probe @object.result for more details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
class CampaignMonitor | ||
# Provides access to the lists and campaigns associated with a client | ||
class Base | ||
|
||
attr_reader :result, :attributes, :cm_client | ||
|
||
@@client=nil | ||
|
||
def self.client | ||
@@client | ||
end | ||
|
||
def self.client=(a) | ||
@@client=a | ||
end | ||
|
||
def [](k) | ||
if m=self.class.get_data_types[k] | ||
@attributes[k].send(m) | ||
else | ||
@attributes[k] | ||
end | ||
end | ||
|
||
def []=(k,v) | ||
@attributes[k]=v | ||
end | ||
|
||
def initialize(*args) | ||
@attributes={} | ||
@cm_client=@@client | ||
end | ||
|
||
# id and name field stuff | ||
|
||
inherited_property "id_field", "id" | ||
inherited_property "name_field", "name" | ||
inherited_property "data_types", {} | ||
|
||
def id | ||
@attributes[self.class.get_id_field] | ||
end | ||
|
||
def id=(v) | ||
@attributes[self.class.get_id_field]=v | ||
end | ||
|
||
def name | ||
@attributes[self.class.get_name_field] | ||
end | ||
|
||
end | ||
|
||
end | ||
|
Oops, something went wrong.