Sha256: 0b46b88b85401f991f9f8eb3edbdd9ff5f728c76c0634e5c1f8c2753924c9c9f

Contents?: true

Size: 819 Bytes

Versions: 5

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

module Supersaas
  # REF: https://www.supersaas.com/info/dev/form_api
  class Forms < BaseApi
    def list(template_form_id, from_time = nil, user = nil)
      path = '/forms'
      params = { form_id: validate_id(template_form_id) }
      params.merge!(from: validate_datetime(from_time)) if from_time
      params.merge!(user: validate_user(user)) if user
      res = client.get(path, params)
      res.map { |attributes| Supersaas::Form.new(attributes) }
    end

    def get(form_id)
      path = '/forms'
      params = { id: validate_id(form_id) }
      res = client.get(path, params)
      Supersaas::Form.new(res)
    end

    def forms
      path = '/super_forms'
      res = client.get(path)
      res.map { |attributes| Supersaas::SuperForm.new(attributes) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
supersaas-api-client-2.0.4 lib/supersaas-api-client/api/forms.rb
supersaas-api-client-2.0.3 lib/supersaas-api-client/api/forms.rb
supersaas-api-client-2.0.2 lib/supersaas-api-client/api/forms.rb
supersaas-api-client-2.0.1 lib/supersaas-api-client/api/forms.rb
supersaas-api-client-2.0.0 lib/supersaas-api-client/api/forms.rb