Class: Interage::ApplicationRequest

Inherits:
Request::Base show all
Defined in:
lib/interage/application_request.rb

Direct Known Subclasses

ApplicationRequest

Instance Method Summary collapse

Instance Method Details

#all(params = {}) ⇒ Object



9
10
11
12
13
# File 'lib/interage/application_request.rb', line 9

def all(params = {})
  @response = get(path: base_path, params: params)

  collection_response.map { |attributes| klass.new(attributes) }
end

#create(params) ⇒ Object



15
16
17
# File 'lib/interage/application_request.rb', line 15

def create(params)
  post(path: base_path, params: params)
end

#destroy(id, params = {}) ⇒ Object



29
30
31
# File 'lib/interage/application_request.rb', line 29

def destroy(id, params = {})
  delete(path: member_path(id), params: params)
end

#find(id, params = {}) ⇒ Object



19
20
21
22
23
# File 'lib/interage/application_request.rb', line 19

def find(id, params = {})
  @response = get(path: member_path(id), params: params)

  klass.new(member_response) if member_response.present?
end

#paginate(page, params: {}) ⇒ Object



5
6
7
# File 'lib/interage/application_request.rb', line 5

def paginate(page, params: {})
  all(params.merge(page: page))
end

#update(id, params = {}) ⇒ Object



25
26
27
# File 'lib/interage/application_request.rb', line 25

def update(id, params = {})
  put(path: member_path(id), params: params)
end