Class: Twilio::REST::Studio::V2::FlowContext::FlowTestUserContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ FlowTestUserContext

Initialize the FlowTestUserContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    Unique identifier of the flow.



52
53
54
55
56
57
58
59
60
61
# File 'lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb', line 52

def initialize(version, sid)
    super(version)
    

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/Flows/#{@solution[:sid]}/TestUsers"

    
end

Instance Method Details

#fetchFlowTestUserInstance

Fetch the FlowTestUserInstance

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb', line 65

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    FlowTestUserInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#fetch_with_metadataFlowTestUserInstance

Fetch the FlowTestUserInstanceMetadata

Returns:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb', line 84

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    flow_test_user_instance = FlowTestUserInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    FlowTestUserInstanceMetadata.new(
        @version,
        flow_test_user_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



174
175
176
177
# File 'lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb', line 174

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Studio.V2.FlowTestUserContext #{context}>"
end

#to_sObject

Provide a user friendly representation



167
168
169
170
# File 'lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb', line 167

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Studio.V2.FlowTestUserContext #{context}>"
end

#update(test_users: nil) ⇒ FlowTestUserInstance

Update the FlowTestUserInstance

Parameters:

  • test_users (Array[String]) (defaults to: nil)

    List of test user identities that can test draft versions of the flow.

Returns:



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb', line 110

def update(
    test_users: nil
)

    data = Twilio::Values.of({
        'TestUsers' => Twilio.serialize_list(test_users) { |e| e },
    })

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

#update_with_metadata(test_users: nil) ⇒ FlowTestUserInstance

Update the FlowTestUserInstanceMetadata

Parameters:

  • test_users (Array[String]) (defaults to: nil)

    List of test user identities that can test draft versions of the flow.

Returns:



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.rb', line 136

def (
  test_users: nil
)

    data = Twilio::Values.of({
        'TestUsers' => Twilio.serialize_list(test_users) { |e| e },
    })

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