Class: Billimatic::Resources::Plan

Inherits:
Base
  • Object
show all
Defined in:
lib/billimatic/resources/plan.rb

Instance Attribute Summary

Attributes inherited from Base

#http

Instance Method Summary collapse

Methods inherited from Base

#collection_name, crud, #initialize, #list_by_organization, #parsed_body, #show, #show_by_organization

Methods included from Hooks

#notify

Constructor Details

This class inherits a constructor from Billimatic::Resources::Base

Instance Method Details

#create(params, organization_id:) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/billimatic/resources/plan.rb', line 8

def create(params, organization_id:)
  http.post(
    "/organizations/#{organization_id}#{resource_base_path}",
    body: { plan: params }
  ) do |response|
    respond_with_entity(response)
  end
end

#destroy(id, organization_id:) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/billimatic/resources/plan.rb', line 26

def destroy(id, organization_id:)
  http.delete(
    "/organizations/#{organization_id}#{resource_base_path}/#{id}"
  ) do |response|
    response.code == 204
  end
end

#list(organization_id:) ⇒ Object



4
5
6
# File 'lib/billimatic/resources/plan.rb', line 4

def list(organization_id:)
  list_by_organization(organization_id)
end

#update(id, params, organization_id:) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/billimatic/resources/plan.rb', line 17

def update(id, params, organization_id:)
  http.put(
    "/organizations/#{organization_id}#{resource_base_path}/#{id}",
    body: { plan: params }
  ) do |response|
    respond_with_entity(response)
  end
end