mirror of
				https://github.com/fog/fog.git
				synced 2022-11-09 13:51:43 -05:00 
			
		
		
		
	add support for getting values from an instrumentation
This commit is contained in:
		
							parent
							
								
									542b442365
								
							
						
					
					
						commit
						72cfed5b35
					
				
					 3 changed files with 27 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -21,6 +21,7 @@ module Fog
 | 
			
		|||
      request :get_instrumentation
 | 
			
		||||
      request :create_instrumentation
 | 
			
		||||
	    request :delete_instrumentation
 | 
			
		||||
      request :get_instrumentation_value
 | 
			
		||||
 | 
			
		||||
      model_path 'fog/joyent/models/analytics'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +43,9 @@ module Fog
 | 
			
		|||
      collection :instrumentations
 | 
			
		||||
      model :instrumentation
 | 
			
		||||
 | 
			
		||||
      model :value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      class Mock
 | 
			
		||||
        def self.data
 | 
			
		||||
          @data ||= Hash.new do |hash, key|
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								lib/fog/joyent/models/analytics/value.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								lib/fog/joyent/models/analytics/value.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
require 'fog/core/model'
 | 
			
		||||
 | 
			
		||||
module Fog
 | 
			
		||||
  module Joyent
 | 
			
		||||
    class Analytics
 | 
			
		||||
      class Value < Fog::Model
 | 
			
		||||
        attribute :value
 | 
			
		||||
        attribute :transformations
 | 
			
		||||
        attribute :start_time, :type => :timestamp
 | 
			
		||||
        attribute :duration
 | 
			
		||||
        attribute :end_time, :type => :timestamp
 | 
			
		||||
        attribute :nsources
 | 
			
		||||
        attribute :minreporting
 | 
			
		||||
        attribute :requested_start_time, :type => :timestamp
 | 
			
		||||
        attribute :requested_duration
 | 
			
		||||
        attribute :requested_end_time, :type => :timestamp
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -2,16 +2,15 @@ module Fog
 | 
			
		|||
  module Joyent
 | 
			
		||||
    class Analytics
 | 
			
		||||
      class Real
 | 
			
		||||
        def get_instrumentation_value(url, requested_start_time, requested_end_time)
 | 
			
		||||
        def get_instrumentation_value(url, requested_start_time, ndatapoints)
 | 
			
		||||
          request(
 | 
			
		||||
              :path => url,
 | 
			
		||||
              :method => 'GET',
 | 
			
		||||
              :debug_request => true,
 | 
			
		||||
              :expects => 200,
 | 
			
		||||
              :query => {
 | 
			
		||||
                  :start_time => requested_start_time.to_i,
 | 
			
		||||
                  :duration => requested_end_time.to_i - requested_start_time.to_i,
 | 
			
		||||
                  :end_time => requested_end_time.to_i
 | 
			
		||||
                  :ndatapoints => ndatapoints,
 | 
			
		||||
                  :start_time => requested_start_time.to_i
 | 
			
		||||
              }
 | 
			
		||||
          )
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue