Class: Unitpost::Resources::Contacts

Inherits:
Base
  • Object
show all
Defined in:
lib/unitpost/resources.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Unitpost::Resources::Base

Instance Method Details

#create(body) ⇒ Object



118
119
120
# File 'lib/unitpost/resources.rb', line 118

def create(body)
  @http.request("POST", "/contacts", body: body)
end

#delete(id_or_email) ⇒ Object



130
131
132
# File 'lib/unitpost/resources.rb', line 130

def delete(id_or_email)
  @http.request("DELETE", "/contacts/#{enc(id_or_email)}")
end

#get(id_or_email) ⇒ Object



122
123
124
# File 'lib/unitpost/resources.rb', line 122

def get(id_or_email)
  @http.request("GET", "/contacts/#{enc(id_or_email)}")
end

#get_import(id) ⇒ Object



142
143
144
# File 'lib/unitpost/resources.rb', line 142

def get_import(id)
  @http.request("GET", "/contacts/imports/#{enc(id)}")
end

#import(body) ⇒ Object



134
135
136
# File 'lib/unitpost/resources.rb', line 134

def import(body)
  @http.request("POST", "/contacts/imports", body: body)
end

#list(limit: nil, after: nil, before: nil) ⇒ Object



110
111
112
# File 'lib/unitpost/resources.rb', line 110

def list(limit: nil, after: nil, before: nil)
  @http.request("GET", "/contacts", query: list_params(limit: limit, after: after, before: before))
end

#list_all(**params) ⇒ Object



114
115
116
# File 'lib/unitpost/resources.rb', line 114

def list_all(**params)
  paginate("/contacts", params)
end

#list_imports(limit: nil, after: nil, before: nil) ⇒ Object



138
139
140
# File 'lib/unitpost/resources.rb', line 138

def list_imports(limit: nil, after: nil, before: nil)
  @http.request("GET", "/contacts/imports", query: list_params(limit: limit, after: after, before: before))
end

#update(id_or_email, body) ⇒ Object



126
127
128
# File 'lib/unitpost/resources.rb', line 126

def update(id_or_email, body)
  @http.request("PATCH", "/contacts/#{enc(id_or_email)}", body: body)
end