Module: RockRMS::Client::Group

Included in:
RockRMS::Client
Defined in:
lib/rock_rms/resources/group.rb

Instance Method Summary collapse

Instance Method Details

#find_group(id) ⇒ Object



8
9
10
# File 'lib/rock_rms/resources/group.rb', line 8

def find_group(id)
  Response::Group.format(get(group_path(id)))
end

#list_families_for_person(person_id, options = {}) ⇒ Object



22
23
24
25
26
# File 'lib/rock_rms/resources/group.rb', line 22

def list_families_for_person(person_id, options = {})
  Response::Group.format(
    get("Groups/GetFamilies/#{person_id}", options)
  )
end

#list_groups(options = {}) ⇒ Object



4
5
6
# File 'lib/rock_rms/resources/group.rb', line 4

def list_groups(options = {})
  Response::Group.format(get(group_path, options))
end

#list_groups_for_person(person_id, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/rock_rms/resources/group.rb', line 12

def list_groups_for_person(person_id, options = {})
  opts = options.dup
  opts['$filter'] = Array(opts['$filter'])
    .push("Members/any(m: m/PersonId eq #{person_id})")
    .join(' and ')
  opts['$expand'] ||= 'Members'

  list_groups(opts)
end

#save_group_address(group_id:, location_type_id:, address:) ⇒ Object

address_format

street1:,
street2:,
city:,
state:,
postal_code:,
country:,



39
40
41
42
43
# File 'lib/rock_rms/resources/group.rb', line 39

def save_group_address(group_id:, location_type_id:, address:)
  url_params = TransformHashKeys.camelize_keys(address)

  put("Groups/SaveAddress/#{group_id}/#{location_type_id}?#{URI.encode_www_form(url_params)}")
end