Class: VoiceML::ApplicationsResource

Inherits:
BaseResource show all
Defined in:
lib/voiceml/resources/applications.rb

Overview

Operations on ‘/Applications` — persistent TwiML+callback bundles.

Constant Summary collapse

APPLICATION_FIELDS =
{
  'FriendlyName'           => :friendly_name,
  'VoiceUrl'               => :voice_url,
  'VoiceMethod'            => :voice_method,
  'VoiceFallbackUrl'       => :voice_fallback_url,
  'VoiceFallbackMethod'    => :voice_fallback_method,
  'VoiceCallerIdLookup'    => :voice_caller_id_lookup,
  'StatusCallback'         => :status_callback,
  'StatusCallbackMethod'   => :status_callback_method,
  'StatusCallbackEvent'    => :status_callback_event
}.freeze
LIST_FIELDS =
{
  'FriendlyName' => :friendly_name,
  'Page'         => :page,
  'PageSize'     => :page_size,
  'PageToken'    => :page_token
}.freeze

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from VoiceML::BaseResource

Instance Method Details

#create(**kwargs) ⇒ VoiceML::Application



29
30
31
32
33
34
# File 'lib/voiceml/resources/applications.rb', line 29

def create(**kwargs)
  Application.from_hash(
    @transport.request(:post, path('Applications'),
                       form: form_params(APPLICATION_FIELDS, kwargs))
  )
end

#delete(application_sid) ⇒ nil

Returns:

  • (nil)


57
58
59
60
# File 'lib/voiceml/resources/applications.rb', line 57

def delete(application_sid)
  @transport.request(:delete, path('Applications', application_sid))
  nil
end

#get(application_sid) ⇒ VoiceML::Application



44
45
46
# File 'lib/voiceml/resources/applications.rb', line 44

def get(application_sid)
  Application.from_hash(@transport.request(:get, path('Applications', application_sid)))
end

#list(**kwargs) ⇒ VoiceML::ApplicationList



37
38
39
40
41
# File 'lib/voiceml/resources/applications.rb', line 37

def list(**kwargs)
  ApplicationList.from_hash(
    @transport.request(:get, path('Applications'), params: form_params(LIST_FIELDS, kwargs))
  )
end

#update(application_sid, **kwargs) ⇒ VoiceML::Application



49
50
51
52
53
54
# File 'lib/voiceml/resources/applications.rb', line 49

def update(application_sid, **kwargs)
  Application.from_hash(
    @transport.request(:post, path('Applications', application_sid),
                       form: form_params(APPLICATION_FIELDS, kwargs))
  )
end