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)


87
88
89
# File 'lib/onsip/models/organization.rb', line 87

def add(*args)
  raise NotImplementedError
end

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

Yields:

  • (response)


33
34
35
36
37
38
# File 'lib/onsip/models/organization.rb', line 33

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)


97
98
99
# File 'lib/onsip/models/organization.rb', line 97

def edit_authenticated(*args)
  raise NotImplementedError
end

#edit_contact(*args) ⇒ Object

TODO

Raises:

  • (NotImplementedError)


92
93
94
# File 'lib/onsip/models/organization.rb', line 92

def edit_contact(*args)
  raise NotImplementedError
end

#migrate_domain(organization_id, old_domain, new_domain) {|response| ... } ⇒ Object

Yields:

  • (response)


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

def migrate_domain(organization_id, old_domain, new_domain)
  params = {'Action' => 'OrganizationMigrateDomain', 'OrganizationId' => organization_id, 'OldDomain' => old_domain, 'NewDomain' => new_domain, 'SessionId' => OnSIP.session.id, 'Output' => 'json'}
  response = OnSIP.connection.get('/api', params, {})
  yield response if block_given?
  process_migrate_domain_response response
end

#process_browse_organization_response(response) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/onsip/models/organization.rb', line 40

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

Yields:

  • (response)


75
76
77
78
79
80
81
82
83
84
# File 'lib/onsip/models/organization.rb', line 75

def process_migrate_domain_response(response)
  organization = nil

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

  organization
end

#process_read_organization_response(response) {|response| ... } ⇒ Object

Yields:

  • (response)


57
58
59
60
61
62
63
64
65
66
# File 'lib/onsip/models/organization.rb', line 57

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)


50
51
52
53
54
55
# File 'lib/onsip/models/organization.rb', line 50

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