silo_manager 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/silo_manager +4 -5
  2. data/lib/nexpose.rb +18 -14
  3. metadata +5 -5
data/bin/silo_manager CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
3
2
  # TODO: Fix multi-byte problem (copied and pasted from PDF)
4
3
 
5
4
  require 'rubygems'
@@ -32,9 +31,9 @@ SILO_CONFIG_ATTRS = ['id:string:required', 'name:string:required', 'silo-profile
32
31
  'description:string:optional', 'max-assets:integer:required', 'max-hosted-assets:integer:required',
33
32
  'max-users:integer:required']
34
33
 
35
- MERCHANT_ATTRS = ['acquirer-relationship:boolean:required', 'agentrelationship:boolean:required',
36
- 'payment-application:string:required', 'paymentversion:string:required', 'ecommerce:boolean:required',
37
- 'grocery:boolean:required', 'mail-order:boolean:required', 'petroleum:boolean:required', 'retail:boolean:required',
34
+ MERCHANT_ATTRS = ['acquirer-relationship:boolean:required', 'agent-relationship:boolean:required',
35
+ 'payment-application:string:required', 'payment-version:string:required', 'ecommerce:boolean:required',
36
+ 'grocery:boolean:required', 'mail-order:boolean:required', 'petroleum:boolean:required', 'retail:boolean:required',
38
37
  'telecommunication:boolean:required', 'travel:boolean:required', 'url:string:required', 'company:string:required',
39
38
  'email-address:string:optional', 'first-name:string:required', 'last-name:string:required', 'phone-number:string:required',
40
39
  'title:string:optional']
@@ -176,7 +175,7 @@ def get_value_array integer=false, restricted_values=[]
176
175
  end
177
176
  end
178
177
 
179
- output << integer ? part.to_i : part.to_s
178
+ output << (integer ? part.to_i : part.to_s)
180
179
  end
181
180
  success = true
182
181
  rescue Exception
data/lib/nexpose.rb CHANGED
@@ -564,7 +564,7 @@ module NexposeAPI
564
564
  #-------------------------------------------------------------------------
565
565
  def create_silo_profile silo_profile_config, permissions
566
566
  xml = make_xml 'SiloProfileCreateRequest'
567
- xml.add_element make_xml('SiloProfileConfig', silo_profile_config, '', false)
567
+ spc_xml = make_xml('SiloProfileConfig', silo_profile_config, '', false)
568
568
 
569
569
  # Add the permissions
570
570
  if permissions['global_report_templates']
@@ -572,7 +572,7 @@ module NexposeAPI
572
572
  permissions['global_report_templates'].each do |name|
573
573
  grt_xml.add_element make_xml('GlobalReportTemplate', {'name' => name}, '', false)
574
574
  end
575
- xml.add_element grt_xml
575
+ spc_xml.add_element grt_xml
576
576
  end
577
577
 
578
578
  if permissions['global_scan_engines']
@@ -580,7 +580,7 @@ module NexposeAPI
580
580
  permissions['global_scan_engines'].each do |name|
581
581
  gse_xml.add_element make_xml('GlobalScanEngine', {'name' => name}, '', false)
582
582
  end
583
- xml.add_element gse_xml
583
+ spc_xml.add_element gse_xml
584
584
  end
585
585
 
586
586
  if permissions['global_scan_templates']
@@ -588,7 +588,7 @@ module NexposeAPI
588
588
  permissions['global_scan_templates'].each do |name|
589
589
  gst_xml.add_element make_xml('GlobalScanTemplate', {'name' => name}, '', false)
590
590
  end
591
- xml.add_element gst_xml
591
+ spc_xml.add_element gst_xml
592
592
  end
593
593
 
594
594
  if permissions['licensed_modules']
@@ -596,7 +596,7 @@ module NexposeAPI
596
596
  permissions['licensed_modules'].each do |name|
597
597
  lm_xml.add_element make_xml('LicensedModule', {'name' => name}, '', false)
598
598
  end
599
- xml.add_element lm_xml
599
+ spc_xml.add_element lm_xml
600
600
  end
601
601
 
602
602
  if permissions['restricted_report_formats']
@@ -604,7 +604,7 @@ module NexposeAPI
604
604
  permissions['restricted_report_formats'].each do |name|
605
605
  rrf_xml.add_element make_xml('RestrictedReportFormat', {'name' => name}, '', false)
606
606
  end
607
- xml.add_element rrf_xml
607
+ spc_xml.add_element rrf_xml
608
608
  end
609
609
 
610
610
  if permissions['restricted_report_sections']
@@ -612,9 +612,10 @@ module NexposeAPI
612
612
  permissions['restricted_report_sections'].each do |name|
613
613
  rrs_xml.add_element make_xml('RestrictedReportSection', {'name' => name}, '', false)
614
614
  end
615
- xml.add_element rrs_xml
615
+ spc_xml.add_element rrs_xml
616
616
  end
617
617
 
618
+ xml.add_element spc_xml
618
619
  r = execute xml, '1.2'
619
620
  r.success
620
621
  end
@@ -643,7 +644,7 @@ module NexposeAPI
643
644
 
644
645
  # Add Organization info
645
646
  if silo_config['organization']
646
- org_xml = make_xml 'Organization', silo_config['organization'], '', false
647
+ org_xml = make_xml 'Organization', {}, '', false
647
648
  silo_config['organization'].keys.each do |key|
648
649
  if not 'address'.eql? key
649
650
  org_xml.attributes[key] = silo_config['organization'][key]
@@ -659,17 +660,20 @@ module NexposeAPI
659
660
  if silo_config['merchant']
660
661
  merchant_xml = make_xml 'Merchant', {}, '', false
661
662
 
662
- # add attributes only
663
663
  silo_config['merchant'].keys.each do |key|
664
664
  if not 'dba'.eql? key and not 'other_industries'.eql? key and not 'qsa'.eql? key and not 'address'.eql? key
665
- merchant_xml.attributes[key] = silo_config[key]
665
+ merchant_xml.attributes[key] = silo_config['merchant'][key]
666
666
  end
667
667
  end
668
668
 
669
- #Now add the complex data types
670
- if silo_config['merchant']['dba']
671
- dba_xml = make_xml 'DBAs', {}, '', false
672
- silo_config['merchant']['dbas'].each do |name|
669
+ # Add the merchant address
670
+ merchant_address_xml = make_xml 'Address', silo_config['merchant']['address'], '', false
671
+ merchant_xml.add_element merchant_address_xml
672
+
673
+ #Now add the complex data types
674
+ if silo_config['merchant']['dba']
675
+ dba_xml = make_xml 'DBAs', {}, '', false
676
+ silo_config['merchant']['dba'].each do |name|
673
677
  dba_xml.add_element make_xml('DBA', {'name' => name}, '', false)
674
678
  end
675
679
  merchant_xml.add_element dba_xml
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silo_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-05 00:00:00.000000000 -07:00
12
+ date: 2011-10-06 00:00:00.000000000 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nexpose
17
- requirement: &23695404 !ruby/object:Gem::Requirement
17
+ requirement: &24325236 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: 0.0.4
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *23695404
25
+ version_requirements: *24325236
26
26
  description: ! ' This is a tool is used to provide CRUD silo operations.
27
27
 
28
28
  '
@@ -37,7 +37,7 @@ files:
37
37
  - lib/test.rb
38
38
  - bin/silo_manager
39
39
  has_rdoc: true
40
- homepage: https://github.com/chrlee/Nexpose_silo_manager
40
+ homepage: https://github.com/chrlee/silo_manager
41
41
  licenses: []
42
42
  post_install_message:
43
43
  rdoc_options: []