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



128
129
130
# File 'lib/unitpost/resources.rb', line 128

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

#delete(id_or_email) ⇒ Object



140
141
142
# File 'lib/unitpost/resources.rb', line 140

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

#get(id_or_email) ⇒ Object



132
133
134
# File 'lib/unitpost/resources.rb', line 132

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

#get_import(id) ⇒ Object



152
153
154
# File 'lib/unitpost/resources.rb', line 152

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

#import(body) ⇒ Object



144
145
146
# File 'lib/unitpost/resources.rb', line 144

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

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



120
121
122
# File 'lib/unitpost/resources.rb', line 120

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



124
125
126
# File 'lib/unitpost/resources.rb', line 124

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

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



148
149
150
# File 'lib/unitpost/resources.rb', line 148

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



136
137
138
# File 'lib/unitpost/resources.rb', line 136

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