Class: ForteRuby::API::Objects

Inherits:
Base
  • Object
show all
Defined in:
lib/forte_ruby/api/objects.rb

Instance Attribute Summary

Attributes inherited from Base

#request_data

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ForteRuby::API::Base

Instance Method Details

#allObject



4
5
6
7
8
# File 'lib/forte_ruby/api/objects.rb', line 4

def all
  send_request(url, :get) do |response|
    parse_response(response)
  end
end

#build_from(params) ⇒ Object



10
11
12
# File 'lib/forte_ruby/api/objects.rb', line 10

def build_from(params)
  single_class.new(params.merge(request_data: request_data, new: true))
end

#filter(params) ⇒ Object



20
21
22
23
24
25
# File 'lib/forte_ruby/api/objects.rb', line 20

def filter(params)
  filter_value = params.map{ |key, value| "#{key}+eq+#{value}"}.join("+and+")
  send_request(url + "?filter=#{filter_value}", :get) do |response|
    parse_response(response)
  end
end

#find_by_id(id) ⇒ Object



14
15
16
17
18
# File 'lib/forte_ruby/api/objects.rb', line 14

def find_by_id(id)
  send_request(url + "/#{id}", :get) do |response|
    parse_response(response)
  end
end