Module: OnSIP::Organization::ClassMethods

Included in:
OnSIP::Organization
Defined in:
lib/onsip/models/organization.rb

Instance Method Summary collapse

Instance Method Details

#browse(account_id) ⇒ Object



14
15
16
17
18
# File 'lib/onsip/models/organization.rb', line 14

def browse()
  params = {'Action' => 'OrganizationBrowse', 'AccountId' => , 'SessionId' => OnSIP.session.id, 'Output' => 'json'}
  response = OnSIP.connection.get('/api', params, {})
  process_browse_organization_response response
end

#process_browse_organization_response(response) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/onsip/models/organization.rb', line 20

def process_browse_organization_response(response)
  organizations = []

  key_path = %w(Response Result OrganizationBrowse Organizations Organization)
  a = ResponseParser.parse_response response, key_path
  organizations = a.map { |h| new h } if a

  organizations
end

#process_read_organization_response(response) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/onsip/models/organization.rb', line 36

def process_read_organization_response(response)
  organization = nil

  key_path = %w(Response Result OrganizationRead Organization)
  a = ResponseParser.parse_response response, key_path
  organization = (a.map { |h| new h }).first if a

  organization
end

#read(organization_id) ⇒ Object



30
31
32
33
34
# File 'lib/onsip/models/organization.rb', line 30

def read(organization_id)
  params = {'Action' => 'OrganizationRead', 'OrganizationId' => organization_id, 'SessionId' => OnSIP.session.id, 'Output' => 'json'}
  response = OnSIP.connection.get('/api', params, {})
  process_read_organization_response response
end