Class: Twilio::REST::Api::V2010::AccountContext::CallContext::UserDefinedMessageSubscriptionList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/call/user_defined_message_subscription.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil, call_sid: nil) ⇒ UserDefinedMessageSubscriptionList

Initialize the UserDefinedMessageSubscriptionList

Parameters:

  • version (Version)

    Version that contains the resource



29
30
31
32
33
34
35
36
# File 'lib/twilio-ruby/rest/api/v2010/account/call/user_defined_message_subscription.rb', line 29

def initialize(version, account_sid: nil, call_sid: nil)
    super(version)
    
    # Path Solution
    @solution = { account_sid: , call_sid: call_sid }
    @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/UserDefinedMessageSubscriptions.json"
    
end

Instance Method Details

#create(callback: nil, idempotency_key: :unset, method: :unset) ⇒ UserDefinedMessageSubscriptionInstance

Create the UserDefinedMessageSubscriptionInstance

Parameters:

  • callback (String) (defaults to: nil)

    The URL we should call using the method to send user defined events to your application. URLs must contain a valid hostname (underscores are not permitted).

  • idempotency_key (String) (defaults to: :unset)

    A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated.

  • method (String) (defaults to: :unset)

    The HTTP method Twilio will use when requesting the above Url. Either GET or POST. Default is POST.

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/twilio-ruby/rest/api/v2010/account/call/user_defined_message_subscription.rb', line 43

def create(
    callback: nil, 
    idempotency_key: :unset, 
    method: :unset
)

    data = Twilio::Values.of({
        'Callback' => callback,
        'IdempotencyKey' => idempotency_key,
        'Method' => method,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    UserDefinedMessageSubscriptionInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        call_sid: @solution[:call_sid],
    )
end

#create_with_metadata(callback: nil, idempotency_key: :unset, method: :unset) ⇒ UserDefinedMessageSubscriptionInstance

Create the UserDefinedMessageSubscriptionInstanceMetadata

Parameters:

  • callback (String) (defaults to: nil)

    The URL we should call using the method to send user defined events to your application. URLs must contain a valid hostname (underscores are not permitted).

  • idempotency_key (String) (defaults to: :unset)

    A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated.

  • method (String) (defaults to: :unset)

    The HTTP method Twilio will use when requesting the above Url. Either GET or POST. Default is POST.

Returns:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/twilio-ruby/rest/api/v2010/account/call/user_defined_message_subscription.rb', line 76

def (
  callback: nil, 
  idempotency_key: :unset, 
  method: :unset
)

    data = Twilio::Values.of({
        'Callback' => callback,
        'IdempotencyKey' => idempotency_key,
        'Method' => method,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    user_defined_message_subscription_instance = UserDefinedMessageSubscriptionInstance.new(
        @version,
        response.body,
        account_sid: @solution[:account_sid],
        call_sid: @solution[:call_sid],
    )
    UserDefinedMessageSubscriptionInstanceMetadata.new(
        @version,
        user_defined_message_subscription_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



113
114
115
# File 'lib/twilio-ruby/rest/api/v2010/account/call/user_defined_message_subscription.rb', line 113

def to_s
    '#<Twilio.Api.V2010.UserDefinedMessageSubscriptionList>'
end