Class: Twilio::REST::Preview::Marketplace::AvailableAddOnContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb,
lib/twilio-ruby/rest/preview/marketplace/available_add_on/available_add_on_extension.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected]

Defined Under Namespace

Classes: AvailableAddOnExtensionContext, AvailableAddOnExtensionInstance, AvailableAddOnExtensionList, AvailableAddOnExtensionPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ AvailableAddOnContext

Initialize the AvailableAddOnContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the AvailableAddOn resource to fetch.


154
155
156
157
158
159
160
161
162
163
# File 'lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb', line 154

def initialize(version, sid)
  super(version)

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

  # Dependents
  @extensions = nil
end

Instance Method Details

#extensions(sid = :unset) ⇒ AvailableAddOnExtensionList, AvailableAddOnExtensionContext

Access the extensions

Returns:

Raises:

  • (ArgumentError)

178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb', line 178

def extensions(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return AvailableAddOnExtensionContext.new(@version, @solution[:sid], sid, )
  end

  unless @extensions
    @extensions = AvailableAddOnExtensionList.new(@version, available_add_on_sid: @solution[:sid], )
  end

  @extensions
end

#fetchAvailableAddOnInstance

Fetch the AvailableAddOnInstance

Returns:


168
169
170
171
172
# File 'lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb', line 168

def fetch
  payload = @version.fetch('GET', @uri)

  AvailableAddOnInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


201
202
203
204
# File 'lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb', line 201

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

#to_sObject

Provide a user friendly representation


194
195
196
197
# File 'lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb', line 194

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