class RDStation::Fields

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

Constants

BASE_URL

Public Class Methods

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

Public Instance Methods

all() click to toggle source
# File lib/rdstation/fields.rb, line 14
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 21
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 35
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 28
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 44
def base_url(path = '')
  "#{BASE_URL}/#{path}"
end