Class: Desmoservice::Get
- Inherits:
-
Object
- Object
- Desmoservice::Get
- Defined in:
- lib/get.rb
Class Method Summary collapse
- .families(desmoservice_conf, get_params, http = nil) ⇒ Object
- .ventilation(desmoservice_conf, get_params, http = nil) ⇒ Object
- .word_distribution(desmoservice_conf, get_params, http = nil) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Get
constructor
A new instance of Get.
Constructor Details
Class Method Details
.families(desmoservice_conf, get_params, http = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/get.rb', line 7 def self.families(desmoservice_conf, get_params, http=nil) = get_params.to_h('familles') uri = desmoservice_conf.build_json_uri() if http.nil? json_string = Net::HTTP.get(uri) else request = Net::HTTP::Get.new(uri) response = http.request(request) json_string = response.body end families = Families.new() families.parse_json(json_string) return families end |
.ventilation(desmoservice_conf, get_params, http = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/get.rb', line 22 def self.ventilation(desmoservice_conf, get_params, http=nil) = get_params.to_h('ventilation') uri = desmoservice_conf.build_json_uri() if http.nil? json_string = Net::HTTP.get(uri) else request = Net::HTTP::Get.new(uri) response = http.request(request) json_string = response.body end ventilation = Ventilation.new() ventilation.parse_json(json_string) return ventilation end |
.word_distribution(desmoservice_conf, get_params, http = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/get.rb', line 37 def self.word_distribution(desmoservice_conf, get_params, http=nil) = get_params.to_h('lexiedistribution') uri = desmoservice_conf.build_json_uri() if http.nil? json_string = Net::HTTP.get(uri) else request = Net::HTTP::Get.new(uri) response = http.request(request) json_string = response.body end word_distribution = WordDistribution.new() word_distribution.parse_json(json_string) return word_distribution end |