Module: OnSIP::Organization::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#add(*args) ⇒ Object

TODO

Raises:

  • (NotImplementedError)


65
66
67
# File 'lib/onsip/models/organization.rb', line 65

def add(*args)
  raise NotImplementedError
end

#browse(account_id) {|response| ... } ⇒ Object

Yields:

  • (response)


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

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

#edit_authenticated(*args) ⇒ Object

TODO

Raises:

  • (NotImplementedError)


80
81
82
# File 'lib/onsip/models/organization.rb', line 80

def edit_authenticated(*args)
  raise NotImplementedError
end

#edit_contact(*args) ⇒ Object

TODO

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/onsip/models/organization.rb', line 70

def edit_contact(*args)
  raise NotImplementedError
end

#migrate_domain(*args) ⇒ Object

TODO

Raises:

  • (NotImplementedError)


75
76
77
# File 'lib/onsip/models/organization.rb', line 75

def migrate_domain(*args)
  raise NotImplementedError
end

#process_browse_organization_response(response) ⇒ Object



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

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) {|response| ... } ⇒ Object

Yields:

  • (response)


53
54
55
56
57
58
59
60
61
62
# File 'lib/onsip/models/organization.rb', line 53

def process_read_organization_response(response)
  organization = nil

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

  organization
end

#read(organization_id) {|response| ... } ⇒ Object

Yields:

  • (response)


46
47
48
49
50
51
# File 'lib/onsip/models/organization.rb', line 46

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