Class: BintrayDeploy::Version

Inherits:
Base
  • Object
show all
Includes:
Hashed
Defined in:
lib/bintray_deploy/model/version.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Hashed

#initialize

Methods inherited from Base

#initialize

Instance Attribute Details

#descObject

Returns the value of attribute desc.



5
6
7
# File 'lib/bintray_deploy/model/version.rb', line 5

def desc
  @desc
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/bintray_deploy/model/version.rb', line 5

def name
  @name
end

#pkgObject

Returns the value of attribute pkg.



5
6
7
# File 'lib/bintray_deploy/model/version.rb', line 5

def pkg
  @pkg
end

#repoObject

Returns the value of attribute repo.



5
6
7
# File 'lib/bintray_deploy/model/version.rb', line 5

def repo
  @repo
end

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
# File 'lib/bintray_deploy/model/version.rb', line 7

def create
  payload = {:name => @name, :released => Time.now.utc.iso8601, :desc => @desc || ''}.to_json
  @bintray["/packages/#{C.user}/#{@repo}/#{@pkg}/versions"].post(payload, :content_type =>:json){ |resp, req, res, &b|
if(resp.code !=201)
  raise Exception.new("package versioning failed #{resp}")
end
  }    
end

#deleteObject



16
17
18
19
20
21
22
# File 'lib/bintray_deploy/model/version.rb', line 16

def delete
  @bintray["/packages/#{C.user}/#{@repo}/#{@pkg}/versions/#{@name}"].delete{ |resp, req, res, &b|
    if(resp.code !=200)
 raise Exception.new("failed to delete version failed #{resp}")
    end
  }    
end

#exists?Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
30
31
32
# File 'lib/bintray_deploy/model/version.rb', line 24

def exists?
  @bintray["/packages/#{C.user}/#{@repo}/#{@pkg}/versions/#{@name}"].get{ |resp, req, res, &b|
    if(resp.code !=200)
 return false
    else 
 return true
    end
  }
end