Class: Twilio::REST::FlexApi::V2::FlexUserContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::FlexApi::V2::FlexUserContext
- Defined in:
- lib/twilio-ruby/rest/flex_api/v2/flex_user.rb
Instance Method Summary collapse
-
#fetch ⇒ FlexUserInstance
Fetch the FlexUserInstance.
-
#fetch_with_metadata ⇒ FlexUserInstance
Fetch the FlexUserInstanceMetadata.
-
#initialize(version, instance_sid, flex_user_sid) ⇒ FlexUserContext
constructor
Initialize the FlexUserContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(email: :unset, user_sid: :unset, locale: :unset) ⇒ FlexUserInstance
Update the FlexUserInstance.
-
#update_with_metadata(email: :unset, user_sid: :unset, locale: :unset) ⇒ FlexUserInstance
Update the FlexUserInstanceMetadata.
Constructor Details
#initialize(version, instance_sid, flex_user_sid) ⇒ FlexUserContext
Initialize the FlexUserContext
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 51 def initialize(version, instance_sid, flex_user_sid) super(version) # Path Solution @solution = { instance_sid: instance_sid, flex_user_sid: flex_user_sid, } @uri = "/Instances/#{@solution[:instance_sid]}/Users/#{@solution[:flex_user_sid]}" end |
Instance Method Details
#fetch ⇒ FlexUserInstance
Fetch the FlexUserInstance
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 64 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) FlexUserInstance.new( @version, payload, instance_sid: @solution[:instance_sid], flex_user_sid: @solution[:flex_user_sid], ) end |
#fetch_with_metadata ⇒ FlexUserInstance
Fetch the FlexUserInstanceMetadata
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 84 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) flex_user_instance = FlexUserInstance.new( @version, response.body, instance_sid: @solution[:instance_sid], flex_user_sid: @solution[:flex_user_sid], ) FlexUserInstanceMetadata.new( @version, flex_user_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
189 190 191 192 |
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 189 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.FlexApi.V2.FlexUserContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
182 183 184 185 |
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 182 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.FlexApi.V2.FlexUserContext #{context}>" end |
#update(email: :unset, user_sid: :unset, locale: :unset) ⇒ FlexUserInstance
Update the FlexUserInstance
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 113 def update( email: :unset, user_sid: :unset, locale: :unset ) data = Twilio::Values.of({ 'Email' => email, 'UserSid' => user_sid, 'Locale' => locale, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) FlexUserInstance.new( @version, payload, instance_sid: @solution[:instance_sid], flex_user_sid: @solution[:flex_user_sid], ) end |
#update_with_metadata(email: :unset, user_sid: :unset, locale: :unset) ⇒ FlexUserInstance
Update the FlexUserInstanceMetadata
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 146 def ( email: :unset, user_sid: :unset, locale: :unset ) data = Twilio::Values.of({ 'Email' => email, 'UserSid' => user_sid, 'Locale' => locale, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) flex_user_instance = FlexUserInstance.new( @version, response.body, instance_sid: @solution[:instance_sid], flex_user_sid: @solution[:flex_user_sid], ) FlexUserInstanceMetadata.new( @version, flex_user_instance, response.headers, response.status_code ) end |