Class: Twilio::REST::Events::V1::SchemaContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Events::V1::SchemaContext
- Defined in:
- lib/twilio-ruby/rest/events/v1/schema.rb,
lib/twilio-ruby/rest/events/v1/schema/schema_version.rb
Defined Under Namespace
Classes: SchemaVersionContext, SchemaVersionInstance, SchemaVersionList, SchemaVersionPage
Instance Method Summary collapse
-
#fetch ⇒ SchemaInstance
Fetch the SchemaInstance.
-
#initialize(version, id) ⇒ SchemaContext
constructor
Initialize the SchemaContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#versions(schema_version = :unset) ⇒ SchemaVersionList, SchemaVersionContext
Access the versions.
Constructor Details
#initialize(version, id) ⇒ SchemaContext
Initialize the SchemaContext
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 49 def initialize(version, id) super(version) # Path Solution @solution = { id: id, } @uri = "/Schemas/#{@solution[:id]}" # Dependents @versions = nil end |
Instance Method Details
#fetch ⇒ SchemaInstance
Fetch the SchemaInstance
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 62 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) SchemaInstance.new( @version, payload, id: @solution[:id], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
107 108 109 110 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 107 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Events.V1.SchemaContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
100 101 102 103 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 100 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Events.V1.SchemaContext #{context}>" end |
#versions(schema_version = :unset) ⇒ SchemaVersionList, SchemaVersionContext
Access the versions
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 82 def versions(schema_version=:unset) raise ArgumentError, 'schema_version cannot be nil' if schema_version.nil? if schema_version != :unset return SchemaVersionContext.new(@version, @solution[:id],schema_version ) end unless @versions @versions = SchemaVersionList.new( @version, id: @solution[:id], ) end @versions end |