Class: Rbdash::Request
- Inherits:
-
Object
- Object
- Rbdash::Request
- Includes:
- HTTParty
- Defined in:
- lib/rbdash/request.rb
Instance Method Summary collapse
- #get(ep, params: {}, options: {}) ⇒ Object
-
#initialize ⇒ Request
constructor
debug_output $stdout.
- #post(ep, body: {}, options: {}) ⇒ Object
Constructor Details
#initialize ⇒ Request
debug_output $stdout
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rbdash/request.rb', line 10 def initialize conf_file = './.rbdash.yml' config = YAML.load_file(conf_file) self.class.base_uri(config['base_uri']) = { verify: false, headers: { 'Authorization' => config['token'], 'Content-Type' => 'application/json' } } end |
Instance Method Details
#get(ep, params: {}, options: {}) ⇒ Object
23 24 25 |
# File 'lib/rbdash/request.rb', line 23 def get(ep, params: {}, options: {}) self.class.get(ep, .merge(.merge(query: params))) end |
#post(ep, body: {}, options: {}) ⇒ Object
27 28 29 |
# File 'lib/rbdash/request.rb', line 27 def post(ep, body: {}, options: {}) self.class.post(ep, .merge(.merge(body: body.to_json))) end |