Class: EmailDirect::Source
- Inherits:
-
Object
- Object
- EmailDirect::Source
- Defined in:
- lib/emaildirect/source.rb
Overview
Represents a source and associated functionality
Instance Attribute Summary collapse
-
#source_id ⇒ Object
readonly
Returns the value of attribute source_id.
Class Method Summary collapse
Instance Method Summary collapse
- #add_emails(email_addresses) ⇒ Object
- #delete ⇒ Object
- #details ⇒ Object
-
#initialize(source_id) ⇒ Source
constructor
A new instance of Source.
- #members(options = {}) ⇒ Object
- #update(name, options) ⇒ Object
Constructor Details
#initialize(source_id) ⇒ Source
Returns a new instance of Source.
22 23 24 |
# File 'lib/emaildirect/source.rb', line 22 def initialize(source_id) @source_id = source_id end |
Instance Attribute Details
#source_id ⇒ Object (readonly)
Returns the value of attribute source_id.
20 21 22 |
# File 'lib/emaildirect/source.rb', line 20 def source_id @source_id end |
Class Method Details
.all ⇒ Object
8 9 10 11 |
# File 'lib/emaildirect/source.rb', line 8 def all response = EmailDirect.get '/Sources' Hashie::Mash.new(response) end |
.create(name, options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/emaildirect/source.rb', line 13 def create(name, = {}) .merge! :Name => name response = EmailDirect.post '/Sources', :body => .to_json Hashie::Mash.new(response) end |
Instance Method Details
#add_emails(email_addresses) ⇒ Object
47 48 49 50 51 |
# File 'lib/emaildirect/source.rb', line 47 def add_emails(email_addresses) = { :EmailAddresses => Array(email_addresses) } response = EmailDirect.post uri_for('AddEmails'), :body => .to_json Hashie::Mash.new(response) end |
#delete ⇒ Object
42 43 44 45 |
# File 'lib/emaildirect/source.rb', line 42 def delete response = EmailDirect.delete uri_for, {} Hashie::Mash.new(response) end |
#details ⇒ Object
26 27 28 29 |
# File 'lib/emaildirect/source.rb', line 26 def details response = get Hashie::Mash.new(response) end |
#members(options = {}) ⇒ Object
31 32 33 34 |
# File 'lib/emaildirect/source.rb', line 31 def members( = {}) response = get 'Members', Hashie::Mash.new(response) end |
#update(name, options) ⇒ Object
36 37 38 39 40 |
# File 'lib/emaildirect/source.rb', line 36 def update(name, ) .merge! :Name => name response = EmailDirect.put uri_for, :body => .to_json Hashie::Mash.new(response) end |