Class: TronHttp::Config
- Inherits:
-
Object
- Object
- TronHttp::Config
- Defined in:
- lib/tron_http/config.rb
Overview
Config
Class Method Summary collapse
- .define_endpoint_methods ⇒ Object
- .define_network_methods ⇒ Object
- .endpoints ⇒ Object
- .hostnames ⇒ Object
- .scaffold ⇒ Object
Class Method Details
.define_endpoint_methods ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/tron_http/config.rb', line 30 def self.define_endpoint_methods endpoints.each do |endpoint, | path = ["path"] method = ["method"] variables = ["variables"] Client.define_method(endpoint) do |params = {}| Helpers.validate_variables variables, params HTTP.send method, URI(@hostname + path), params end end end |
.define_network_methods ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/tron_http/config.rb', line 22 def self.define_network_methods hostnames.each_key do |network| TronHttp.define_singleton_method(network) do Client.new network end end end |
.endpoints ⇒ Object
13 14 15 |
# File 'lib/tron_http/config.rb', line 13 def self.endpoints TronHttp::DATA["endpoints"] end |
.hostnames ⇒ Object
9 10 11 |
# File 'lib/tron_http/config.rb', line 9 def self.hostnames TronHttp::DATA["hostnames"] end |
.scaffold ⇒ Object
17 18 19 20 |
# File 'lib/tron_http/config.rb', line 17 def self.scaffold define_network_methods define_endpoint_methods end |