Class: Twilio::REST::Marketplace::V1::AvailableAddOnContext

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

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.



136
137
138
139
140
141
142
143
144
145
# File 'lib/twilio-ruby/rest/marketplace/v1/available_add_on.rb', line 136

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)


169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/twilio-ruby/rest/marketplace/v1/available_add_on.rb', line 169

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:



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/twilio-ruby/rest/marketplace/v1/available_add_on.rb', line 149

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



187
188
189
190
# File 'lib/twilio-ruby/rest/marketplace/v1/available_add_on.rb', line 187

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