class RDStation::Fields

More info: developers.rdstation.com/pt-BR/reference/fields

Public Class Methods

new(authorization:) click to toggle source
# File lib/rdstation/fields.rb, line 9
def initialize(authorization:)
  @authorization = authorization
end

Public Instance Methods

all() click to toggle source
# File lib/rdstation/fields.rb, line 13
def all
  retryable_request(@authorization) do |authorization|
    response = self.class.get(base_url, headers: authorization.headers)
    ApiResponse.build(response)
  end
end
create(payload) click to toggle source
# File lib/rdstation/fields.rb, line 20
def create(payload)
  retryable_request(@authorization) do |authorization|
    response = self.class.post(base_url, headers: authorization.headers, body: payload.to_json)
    ApiResponse.build(response)
  end
end
delete(uuid) click to toggle source
# File lib/rdstation/fields.rb, line 34
def delete(uuid)
  retryable_request(@authorization) do |authorization|
    response = self.class.delete(base_url(uuid), headers: authorization.headers)
    ApiResponse.build(response)
  end
end
update(uuid, payload) click to toggle source
# File lib/rdstation/fields.rb, line 27
def update(uuid, payload)
  retryable_request(@authorization) do |authorization|
    response = self.class.patch(base_url(uuid), headers: authorization.headers, body: payload.to_json)
    ApiResponse.build(response)
  end
end

Private Instance Methods

base_url(path = '') click to toggle source
# File lib/rdstation/fields.rb, line 43
def base_url(path = '')
  "#{RDStation.host}/platform/contacts/fields/#{path}"
end