Class: Besepa::Group

Inherits:
Resource show all
Includes:
ApiCalls::Create, ApiCalls::Destroy, ApiCalls::List, ApiCalls::Update
Defined in:
lib/besepa/group.rb

Constant Summary collapse

FIELDS =
[:id, :name, :reference, :created_at, :memberships_count]

Constants inherited from Resource

Resource::ALLOWED_NILS

Constants included from Utils::Request

Utils::Request::END_POINT_URL_PREFIX

Instance Attribute Summary

Attributes inherited from Resource

#activities

Instance Method Summary collapse

Methods included from ApiCalls::Destroy

#destroy

Methods included from ApiCalls::Update

#save

Methods included from ApiCalls::Create

included

Methods included from ApiCalls::List

included

Methods inherited from Resource

#allowed_nils, #as_json, handle_errors, #initialize, klass_name, #klass_name, #serializable_hash, #to_hash

Methods included from Utils::Request

#delete, #get, #post, #put

Methods included from Utils::Connection

#connection

Constructor Details

This class inherits a constructor from Besepa::Resource

Instance Method Details

#api_path(filters = {}) ⇒ Object



24
25
26
# File 'lib/besepa/group.rb', line 24

def api_path(filters = {})
  "#{self.class.api_path(filters)}/#{CGI.escape(id)}"
end

#customersObject



15
16
17
# File 'lib/besepa/group.rb', line 15

def customers
  Customer.search({ field: :group_id, value: id})
end

#statsObject



19
20
21
22
# File 'lib/besepa/group.rb', line 19

def stats
  response = get "#{api_path}/stats"
  response['response']
end