Sha256: a0250f9b215363703edf0b0f83804af91fd4a288cfc9031a97c9a592aebe490f

Contents?: true

Size: 981 Bytes

Versions: 3

Compression:

Stored size: 981 Bytes

Contents

class Fastly
  class BelongsToServiceAndVersion < Base
    # Return the Service object this belongs to
    def service
      @service ||= fetcher.get(Fastly::Service, service_id)
    end
    
    # Set the Version object this belongs to
    def version=(version)
      @version = version
    end
    
    # Get the Version object this belongs to
    def version
      @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)
    end
    
    # Get the number of the Version this belongs to
    def version_number
      @version
    end
    
    private
    
    def self.get_path(service, version, name)
      "/service/#{service}/version/#{version}/#{path}/#{name}"
    end
    
    def self.post_path(opts)
    "/service/#{opts[:service_id]}/version/#{opts[:version]}/#{path}"
    end
    
    def self.put_path(obj)
      get_path(obj.service_id, obj.version_number,obj.name)
    end
    
    def self.delete_path(obj)
      put_path(obj)
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastly-0.95 lib/fastly/belongs_to_service_and_version.rb
fastly-0.9 lib/fastly/belongs_to_service_and_version.rb
fastly-0.5 lib/fastly/belongs_to_service_and_version.rb