Class: Twilio::REST::Pricing::V1::MessagingList::CountryContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Pricing::V1::MessagingList::CountryContext
- Defined in:
- lib/twilio-ruby/rest/pricing/v1/messaging/country.rb
Instance Method Summary collapse
-
#fetch ⇒ CountryInstance
Fetch the CountryInstance.
-
#fetch_with_metadata ⇒ CountryInstance
Fetch the CountryInstanceMetadata.
-
#initialize(version, iso_country) ⇒ CountryContext
constructor
Initialize the CountryContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, iso_country) ⇒ CountryContext
Initialize the CountryContext
161 162 163 164 165 166 167 168 169 170 |
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 161 def initialize(version, iso_country) super(version) # Path Solution @solution = { iso_country: iso_country, } @uri = "/Messaging/Countries/#{@solution[:iso_country]}" end |
Instance Method Details
#fetch ⇒ CountryInstance
Fetch the CountryInstance
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 174 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) CountryInstance.new( @version, payload, iso_country: @solution[:iso_country], ) end |
#fetch_with_metadata ⇒ CountryInstance
Fetch the CountryInstanceMetadata
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 193 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) country_instance = CountryInstance.new( @version, response.body, iso_country: @solution[:iso_country], ) CountryInstanceMetadata.new( @version, country_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
225 226 227 228 |
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 225 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Pricing.V1.CountryContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
218 219 220 221 |
# File 'lib/twilio-ruby/rest/pricing/v1/messaging/country.rb', line 218 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Pricing.V1.CountryContext #{context}>" end |