Module: FileboundClient::Endpoints

Included in:
Client
Defined in:
lib/filebound_client/endpoints.rb,
lib/filebound_client/endpoints/files.rb,
lib/filebound_client/endpoints/query.rb,
lib/filebound_client/endpoints/users.rb,
lib/filebound_client/endpoints/groups.rb,
lib/filebound_client/endpoints/routes.rb,
lib/filebound_client/endpoints/version.rb,
lib/filebound_client/endpoints/dividers.rb,
lib/filebound_client/endpoints/projects.rb,
lib/filebound_client/endpoints/documents.rb,
lib/filebound_client/endpoints/eform_data.rb,
lib/filebound_client/endpoints/separators.rb,
lib/filebound_client/endpoints/assignments.rb,
lib/filebound_client/endpoints/eform_detail.rb,
lib/filebound_client/endpoints/routed_items.rb,
lib/filebound_client/endpoints/document_binary_data.rb

Overview

Module for resource endpoints

Defined Under Namespace

Modules: Assignments, Dividers, DocumentBinaryData, Documents, EFormData, EFormDetail, Files, Groups, Projects, Query, RoutedItems, Routes, Separators, Users, Version

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

Sets up macros for use by endpoints and includes all endpoints rubocop:disable Metrics/MethodLength, Metrics/AbcSize



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/filebound_client/endpoints.rb', line 8

def self.included(klass)
  klass.instance_eval do
    # @!macro [attach] fb.allow_new
    # Returns a new empty resource with defaulted values
    # @return [Hash] a new hash of $1
    def self.allow_new(name)
      define_method("#{name}_new") do
        get('/empty', template: name.to_s)
      end
    end

    # @!macro [attach] fb.allow_all
    # Returns an array $1 hashes
    # @param [Hash] query_params params to pass to the request
    # @return [Array] an array of $1 hashes
    def self.allow_all(name)
      define_method(name.to_s) do |query_params = nil|
        get("/#{name}", query_params)
      end
    end
  end

  klass.class_eval do
    include FileboundClient::Endpoints::Projects
    include FileboundClient::Endpoints::Files
    include FileboundClient::Endpoints::Documents
    include FileboundClient::Endpoints::Version
    include FileboundClient::Endpoints::Assignments
    include FileboundClient::Endpoints::Dividers
    include FileboundClient::Endpoints::DocumentBinaryData
    include FileboundClient::Endpoints::EFormData
    include FileboundClient::Endpoints::EFormDetail
    include FileboundClient::Endpoints::Separators
    include FileboundClient::Endpoints::Query
    include FileboundClient::Endpoints::Users
    include FileboundClient::Endpoints::Routes
    include FileboundClient::Endpoints::RoutedItems
    include FileboundClient::Endpoints::Groups
  end
end