## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Preview # This is the public Twilio REST API. # # NOTE: This class is auto generated by OpenAPI Generator. # https://openapi-generator.tech # Do not edit the class manually. # module Twilio module REST class Preview < PreviewBase class Wireless < Version class SimContext < InstanceContext class UsageList < ListResource ## # Initialize the UsageList # @param [Version] version Version that contains the resource # @return [UsageList] UsageList def initialize(version, sim_sid: nil) super(version) # Path Solution @solution = { sim_sid: sim_sid } end # Provide a user friendly representation def to_s '#' end end class UsageContext < InstanceContext ## # Initialize the UsageContext # @param [Version] version Version that contains the resource # @param [String] sim_sid # @return [UsageContext] UsageContext def initialize(version, sim_sid) super(version) # Path Solution @solution = { sim_sid: sim_sid, } @uri = "/Sims/#{@solution[:sim_sid]}/Usage" end ## # Fetch the UsageInstance # @param [String] end_ # @param [String] start # @return [UsageInstance] Fetched UsageInstance def fetch( end_: :unset, start: :unset ) params = Twilio::Values.of({ 'End' => end_, 'Start' => start, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, params: params, headers: headers) UsageInstance.new( @version, payload, sim_sid: @solution[:sim_sid], ) end ## # Provide a user friendly representation def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end end class UsagePage < Page ## # Initialize the UsagePage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [UsagePage] UsagePage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of UsageInstance # @param [Hash] payload Payload response from the API # @return [UsageInstance] UsageInstance def get_instance(payload) UsageInstance.new(@version, payload, sim_sid: @solution[:sim_sid]) end ## # Provide a user friendly representation def to_s '' end end class UsageInstance < InstanceResource ## # Initialize the UsageInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] account_sid The SID of the # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Usage # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [UsageInstance] UsageInstance def initialize(version, payload , sim_sid: nil) super(version) # Marshaled Properties @properties = { 'sim_sid' => payload['sim_sid'], 'sim_unique_name' => payload['sim_unique_name'], 'account_sid' => payload['account_sid'], 'period' => payload['period'], 'commands_usage' => payload['commands_usage'], 'commands_costs' => payload['commands_costs'], 'data_usage' => payload['data_usage'], 'data_costs' => payload['data_costs'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'sim_sid' => sim_sid || @properties['sim_sid'] , } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [UsageContext] CallContext for this CallInstance def context unless @instance_context @instance_context = UsageContext.new(@version , @params['sim_sid']) end @instance_context end ## # @return [String] def sim_sid @properties['sim_sid'] end ## # @return [String] def sim_unique_name @properties['sim_unique_name'] end ## # @return [String] def account_sid @properties['account_sid'] end ## # @return [Hash] def period @properties['period'] end ## # @return [Hash] def commands_usage @properties['commands_usage'] end ## # @return [Hash] def commands_costs @properties['commands_costs'] end ## # @return [Hash] def data_usage @properties['data_usage'] end ## # @return [Hash] def data_costs @properties['data_costs'] end ## # @return [String] def url @properties['url'] end ## # Fetch the UsageInstance # @param [String] end_ # @param [String] start # @return [UsageInstance] Fetched UsageInstance def fetch( end_: :unset, start: :unset ) context.fetch( end_: end_, start: start, ) end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end end