Class: MonkeyParty::Base
- Inherits:
-
Object
- Object
- MonkeyParty::Base
- Includes:
- HTTParty
- Defined in:
- lib/monkey_party/base.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(attrs = {}) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/monkey_party/base.rb', line 6 def initialize(attrs = {}) attrs.each{ |key, value| self.send("#{key}=", value) } end |
Class Method Details
.api_key ⇒ Object
22 23 24 |
# File 'lib/monkey_party/base.rb', line 22 def api_key MonkeyParty.api_key end |
.default_options ⇒ Object
26 27 28 29 30 |
# File 'lib/monkey_party/base.rb', line 26 def { :base_uri => "http://#{MonkeyParty.data_center}.api.mailchimp.com/1.2" } end |
.get(path, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/monkey_party/base.rb', line 11 def get(path, = {}) #fix the format because Mail Chimp doesn't pass the proper header [:format] = :xml result = super if result.body =~ /<error /i raise MonkeyParty::Error.parse(result.body) end result end |