class Mailflow::Contact
Attributes
confirmed[RW]
created_at[RW]
email[RW]
id[RW]
Public Class Methods
create(attributes)
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 24 def create(attributes) response = post_request('contacts', attributes) raise UnprocessableError if (response.code == 422 || response.code == 404) Contact.new(response.parsed_response) end
get(options = {})
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 19 def get(options = {}) response = get_request('contacts', options) Contact.new(response.parsed_response) if response.code == 200 end
list()
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 12 def list response = get_request('contacts') response.parsed_response.map do |attributes| Contact.new(attributes) end end
new(attributes)
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 31 def initialize(attributes) @id = attributes["id"] @email = attributes["email"] @created_at = attributes["created_at"] @confirmed = attributes["confirmed"] end
Public Instance Methods
==(other)
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 38 def ==(other) self.id == other.id && self.email == other.email && self.confirmed == other.confirmed end
attributes()
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 62 def attributes Mailflow::Attribute.list(contact_id: id) end
delete()
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 44 def delete Mailflow::Contact.delete_request('contacts', {contact_id: id}).parsed_response end
set_attributes(attributes)
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 66 def set_attributes(attributes) attributes = attributes.map do |key, value| {key: key.to_s, label: key.to_s, value: value} end Mailflow::Attribute.update(attributes, {contact_id: id}) self end
tag(tags, trigger = false)
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 52 def tag(tags, trigger = false) Mailflow::Tag.create(tags, {contact_id: id}, trigger) self end
untag(tags)
click to toggle source
# File lib/mailflow-ruby/contact.rb, line 57 def untag(tags) Mailflow::Tag.untag(tags, {contact_id: id}) self end