Class: MailgunResource
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- MailgunResource
- Extended by:
- Mailgun::RequestBuilder
- Defined in:
- lib/mailgun.rb
Overview
Base class for Mailgun resource classes It adds upsert() method on top of ActiveResource::Base
Instance Method Summary collapse
-
#upsert ⇒ Object
Create new resource or update it if resource already exist.
Methods included from Mailgun::RequestBuilder
Instance Method Details
#upsert ⇒ Object
Create new resource or update it if resource already exist. There are 2 differences between upsert() and save():
- Upsert does not raise an exception if a resource already exist.
- Upsert does not return the id of freshly inserted resource
>> route = Route.new
>> route.pattern = '*@mydomain.com'
>> route.destination = 'http://mydomain.com/addcomment'
>> route.upsert()
128 129 130 |
# File 'lib/mailgun.rb', line 128 def upsert() self.class.post('upsert', {}, self.to_xml()) end |