Module: Gorillapi
- Includes:
- RequestMethods
- Defined in:
- lib/gorillapi.rb,
lib/gorillapi/version.rb,
lib/gorillapi/curl_builder.rb,
lib/gorillapi/request_builder.rb,
lib/gorillapi/request_methods.rb
Defined Under Namespace
Modules: CurlBuilder, PrintResponse, RequestMethods Classes: RequestBuilder
Constant Summary collapse
- VERSION =
"0.0.11"
Instance Method Summary collapse
- #header(header_name: '', api_key: '', format: 'json', version: 1) ⇒ Object
- #test_api(url: '') ⇒ Object
Methods included from RequestMethods
#build_request, #delete, #get, #handle_print, #post, #put
Methods included from PrintResponse
#print_request, #print_results, #request_details, #show_curl_request
Instance Method Details
#header(header_name: '', api_key: '', format: 'json', version: 1) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/gorillapi.rb', line 17 def header(header_name: '', api_key: '', format: 'json', version: 1) self.class_eval("def content_type;'application/#{format}';end") self.class_eval("def format;'#{format}';end") self.class_eval("def version;'#{version}';end") self.class_eval("def token;'#{api_key}';end") self.class_eval("def accept_header; 'application/vnd.#{header_name}-v#{version}+#{format}'; end") end |
#test_api(url: '') ⇒ Object
13 14 15 |
# File 'lib/gorillapi.rb', line 13 def test_api(url: '') self.class_eval("def url;'#{url}';end") end |