Class: BandwidthIris::SipCredential

Inherits:
Object
  • Object
show all
Extended by:
ClientWrapper
Includes:
ApiItem
Defined in:
lib/bandwidth-iris/sip_credential.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClientWrapper

wrap_client_arg

Methods included from ApiItem

#[], #[]=, #initialize, #to_data

Class Method Details

.create(client, item) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/bandwidth-iris/sip_credential.rb', line 23

def self.create(client, item)
  data = client.make_request(
    :post,
    client.(SIP_CREDENTIAL_PATH),
    { :sip_credentials => { :sip_credential => item } }
  )[0][:valid_sip_credentials]
  SipCredential.new(data[:sip_credential], client)
end

.get(client, id) ⇒ Object



17
18
19
20
# File 'lib/bandwidth-iris/sip_credential.rb', line 17

def self.get(client, id)
  data = client.make_request(:get, "#{client.(SIP_CREDENTIAL_PATH)}/#{id}")[0]
  SipCredential.new(data[:sip_credential], client)
end

.list(client, query = nil) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/bandwidth-iris/sip_credential.rb', line 8

def self.list(client, query = nil)
  list = client.make_request(:get, client.(SIP_CREDENTIAL_PATH), query)[0][:sip_credential]
  list = if list.is_a?(Array) then list else [list] end
  list.map do |i|
    SipCredential.new(i, client)
  end
end

Instance Method Details

#deleteObject



38
39
40
# File 'lib/bandwidth-iris/sip_credential.rb', line 38

def delete
  @client.make_request(:delete,"#{@client.(SIP_CREDENTIAL_PATH)}/#{user_name}")
end

#update(data) ⇒ Object



34
35
36
# File 'lib/bandwidth-iris/sip_credential.rb', line 34

def update(data)
  @client.make_request(:put,"#{@client.(SIP_CREDENTIAL_PATH)}/#{user_name}", {:sip_credential => data})
end