Class: Desmoservice::GetParams
- Inherits:
-
Object
- Object
- Desmoservice::GetParams
- Defined in:
- lib/get_params.rb
Instance Attribute Summary collapse
-
#family_filter ⇒ Object
Returns the value of attribute family_filter.
-
#ignore_empty_sectors ⇒ Object
Returns the value of attribute ignore_empty_sectors.
-
#inferiors_only ⇒ Object
Returns the value of attribute inferiors_only.
-
#query ⇒ Object
Returns the value of attribute query.
-
#ventilation_name ⇒ Object
Returns the value of attribute ventilation_name.
-
#ventilation_root_id ⇒ Object
Returns the value of attribute ventilation_root_id.
-
#ventilation_root_uri ⇒ Object
Returns the value of attribute ventilation_root_uri.
-
#with_attrs ⇒ Object
Returns the value of attribute with_attrs.
-
#with_keys ⇒ Object
Returns the value of attribute with_keys.
-
#with_parent ⇒ Object
Returns the value of attribute with_parent.
Instance Method Summary collapse
-
#initialize ⇒ GetParams
constructor
A new instance of GetParams.
- #to_h(type) ⇒ Object
- #ventilation_name_context=(localkey) ⇒ Object
- #ventilation_name_uri=(uri) ⇒ Object
Constructor Details
#initialize ⇒ GetParams
Returns a new instance of GetParams.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/get_params.rb', line 11 def initialize() @with_keys = true @with_attrs = false @with_parent = false @ventilation_root_id = nil @ventilation_root_uri = nil @ignore_empty_sectors = nil @ventilation_name = 'ventilation:naturelle' @inferiors_only = false @query = nil end |
Instance Attribute Details
#family_filter ⇒ Object
Returns the value of attribute family_filter.
4 5 6 |
# File 'lib/get_params.rb', line 4 def family_filter @family_filter end |
#ignore_empty_sectors ⇒ Object
Returns the value of attribute ignore_empty_sectors.
4 5 6 |
# File 'lib/get_params.rb', line 4 def ignore_empty_sectors @ignore_empty_sectors end |
#inferiors_only ⇒ Object
Returns the value of attribute inferiors_only.
4 5 6 |
# File 'lib/get_params.rb', line 4 def inferiors_only @inferiors_only end |
#query ⇒ Object
Returns the value of attribute query.
4 5 6 |
# File 'lib/get_params.rb', line 4 def query @query end |
#ventilation_name ⇒ Object
Returns the value of attribute ventilation_name.
4 5 6 |
# File 'lib/get_params.rb', line 4 def ventilation_name @ventilation_name end |
#ventilation_root_id ⇒ Object
Returns the value of attribute ventilation_root_id.
4 5 6 |
# File 'lib/get_params.rb', line 4 def ventilation_root_id @ventilation_root_id end |
#ventilation_root_uri ⇒ Object
Returns the value of attribute ventilation_root_uri.
4 5 6 |
# File 'lib/get_params.rb', line 4 def ventilation_root_uri @ventilation_root_uri end |
#with_attrs ⇒ Object
Returns the value of attribute with_attrs.
4 5 6 |
# File 'lib/get_params.rb', line 4 def with_attrs @with_attrs end |
#with_keys ⇒ Object
Returns the value of attribute with_keys.
4 5 6 |
# File 'lib/get_params.rb', line 4 def with_keys @with_keys end |
#with_parent ⇒ Object
Returns the value of attribute with_parent.
4 5 6 |
# File 'lib/get_params.rb', line 4 def with_parent @with_parent end |
Instance Method Details
#to_h(type) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/get_params.rb', line 23 def to_h(type) result = Hash.new result['type'] = type fields = 'libelles,famille-color' fields += ',idctxt,iddesc,grille-name' if @with_keys fields += ',attrs' if @with_attrs fields += ',famille-code,parent-code' if @with_parent fields += ',famille-idctxt,parent-idctxt' if (@with_parent and @with_keys) result['fields'] = fields if not @family_filter.nil? if type == 'ventilation' result['conf:limitation.familles'] = 'true' result['conf:limitation.familles.idctxtarray'] = @family_filter else result['selection_idctxt'] = @family_filter end end if @inferiors_only result['conf:limitation.liens'] = 'true' result['conf:limitation.liens.typearray'] = 'lh_av' end if not @ignore_empty_sectors.nil? if @ignore_empty_sectors result['conf:ignore.empty.secteur'] = 'true' else result['conf:ignore.empty.secteur'] = 'false' end end if type == 'ventilation' if not @ventilation_root_id.nil? result['root_code'] = @ventilation_root_id elsif not @ventilation_root_uri.nil? result['root_uri'] = @ventilation_root_uri end if not @ventilation_name.nil? result['name'] = @ventilation_name end end if type == 'terms' if not @query.nil? result['q'] = @query end end return result end |
#ventilation_name_context=(localkey) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/get_params.rb', line 73 def ventilation_name_context=(localkey) index = localkey.index('/') if index.nil? @ventilation_name = 'ventilation:grille:' + localkey else @ventilation_name = 'ventilation:contexte:' + localkey end end |
#ventilation_name_uri=(uri) ⇒ Object
69 70 71 |
# File 'lib/get_params.rb', line 69 def ventilation_name_uri=(uri) @ventilation_name = 'ventilation:' + uri end |