Skip to content

Commit

Permalink
Renamed gem so not to clash with Veracode gem for RoR analsys
Browse files Browse the repository at this point in the history
  • Loading branch information
mort666 committed Nov 5, 2012
1 parent 0e2e2a0 commit bf94273
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/veracode/admin.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Veracode
class Admin
class Admin < Veracode::Base
end
end
13 changes: 13 additions & 0 deletions lib/veracode/base.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
require 'xmlsimple'

module Veracode
class Base
attr_accessor *Config::VALID_OPTIONS_KEYS

attr_accessor :account_id

include HTTParty

base_uri 'https://analysiscenter.veracode.com'
Expand All @@ -13,6 +17,15 @@ def initialize(options={})
end
end

def account_id
if @account_id.nil?
xml = getXML("/api/4.0/getapplist.do")
@account_id ||= XmlSimple.xml_in(xml.body)['account_id']
else
@account_id
end
end

def getXML(path, debug=false)
auth = { :username => @username, :password => @password }

Expand Down
27 changes: 26 additions & 1 deletion lib/veracode/upload.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
module Veracode
class Upload
class Upload < Veracode::Base
CREATE_APP_URI = "/api/4.0/createapp.do"
DELETE_APP_URI = "/api/4.0/deleteapp.do"
GET_VENDOR_LIST_URI = "/api/4.0/getvendorlist.do"
CREATE_BUILD_URI = "/api/4.0/createbuild.do"
DELETE_BUILD_URI = "/api/4.0/deletebuild.do"
UPLOAD_FILE_URI = "/api/4.0/uploadfile.do"
REMOVE_FILE_URI = "/api/4.0/removefile.do"
GET_FILE_LIST_URI = "/api/4.0/getfilelist.do"
GET_APP_LIST_URI = "/api/4.0/getapplist.do"
GET_APP_INFO_URI = "/api/4.0/getappinfo.do"
GET_BUILD_LIST_URI = "/api/4.0/getbuildlist.do"
GET_BUILD_INFO_URI = "/api/4.0/getbuildinfo.do"
BEGIN_PRESCAN_URI = "/api/4.0/beginprescan.do"
GET_PRESCAN_RESULTS_URI = "/api/4.0/getprescanresults.do"
BEGIN_SCAN_URI = "/api/4.0/beginscan.do"

def get_application_list
xml = getXML(GET_APP_LIST_URI)
case xml.code
when 200
xml.body
else
xml.error!
end
end
end
end
13 changes: 5 additions & 8 deletions veracode.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@ $:.push File.expand_path("../lib", __FILE__)
require "veracode/version"

Gem::Specification.new do |s|
s.name = "veracode"
s.name = "veracode-api"
s.version = Veracode::VERSION
s.authors = ["Stephen Kapp"]
s.email = ["mort666@virus.org"]
s.homepage = ""
s.summary = %q{TODO: Write a gem summary}
s.description = %q{TODO: Write a gem description}
s.summary = %q{Veracode Analysis Service API Wrapper}
s.description = %q{Ruby API Wrapper to access Veracode Security Analysis Service API}

s.rubyforge_project = "veracode"
s.rubyforge_project = "veracode-api"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

# specify any dependencies here; for example:
# s.add_development_dependency "rspec"
# s.add_runtime_dependency "rest-client"

s.add_dependency "httparty"
s.add_dependency "nokogiri"
s.add_dependency "xml-simple"
s.add_dependency "roxml"
s.add_dependency "i18n"

Expand Down

0 comments on commit bf94273

Please sign in to comment.