Class: Twilio::REST::Pricing::V2::CountryContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/pricing/v2/country.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, iso_country) ⇒ CountryContext

Initialize the CountryContext

Parameters:



159
160
161
162
163
164
165
166
167
168
# File 'lib/twilio-ruby/rest/pricing/v2/country.rb', line 159

def initialize(version, iso_country)
    super(version)
    

    # Path Solution
    @solution = { iso_country: iso_country,  }
    @uri = "/Trunking/Countries/#{@solution[:iso_country]}"

    
end

Instance Method Details

#fetchCountryInstance

Fetch the CountryInstance

Returns:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/twilio-ruby/rest/pricing/v2/country.rb', line 172

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_metadataCountryInstance

Fetch the CountryInstanceMetadata

Returns:



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/twilio-ruby/rest/pricing/v2/country.rb', line 191

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],
    )
    .new(
        @version,
        country_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



223
224
225
226
# File 'lib/twilio-ruby/rest/pricing/v2/country.rb', line 223

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

#to_sObject

Provide a user friendly representation



216
217
218
219
# File 'lib/twilio-ruby/rest/pricing/v2/country.rb', line 216

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