Class: CueCloudRequest
- Inherits:
-
Object
- Object
- CueCloudRequest
- Includes:
- HTTParty
- Defined in:
- lib/cuecloud/cuecloud_request.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout.
-
#api_pass ⇒ Object
readonly
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout.
-
#auth_key ⇒ Object
readonly
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout.
-
#base_url ⇒ Object
readonly
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout.
-
#body ⇒ Object
readonly
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout.
-
#logger ⇒ Object
readonly
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout.
Instance Method Summary collapse
- #build_request(resource, method, data = nil) ⇒ Object
-
#initialize(api_key, api_pass, base_url = nil) ⇒ CueCloudRequest
constructor
base_uri CueCloudApi::DEFAULT_BASE_URL + CueCloudApi::API_VERSION.
Constructor Details
#initialize(api_key, api_pass, base_url = nil) ⇒ CueCloudRequest
base_uri CueCloudApi::DEFAULT_BASE_URL + CueCloudApi::API_VERSION
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cuecloud/cuecloud_request.rb', line 12 def initialize(api_key, api_pass,base_url=nil) @api_key = api_key.to_s @api_pass = api_pass.to_s @auth_key = {username: api_key, password: api_pass} if base_url @base_url = base_url else @base_url = CueCloudApi::DEFAULT_BASE_URL + CueCloudApi::API_VERSION end end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout
8 9 10 |
# File 'lib/cuecloud/cuecloud_request.rb', line 8 def api_key @api_key end |
#api_pass ⇒ Object (readonly)
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout
8 9 10 |
# File 'lib/cuecloud/cuecloud_request.rb', line 8 def api_pass @api_pass end |
#auth_key ⇒ Object (readonly)
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout
8 9 10 |
# File 'lib/cuecloud/cuecloud_request.rb', line 8 def auth_key @auth_key end |
#base_url ⇒ Object (readonly)
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout
8 9 10 |
# File 'lib/cuecloud/cuecloud_request.rb', line 8 def base_url @base_url end |
#body ⇒ Object (readonly)
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout
8 9 10 |
# File 'lib/cuecloud/cuecloud_request.rb', line 8 def body @body end |
#logger ⇒ Object (readonly)
uncomment the following line to debug the entire http party and have fun ! debug_output $stdout
8 9 10 |
# File 'lib/cuecloud/cuecloud_request.rb', line 8 def logger @logger end |
Instance Method Details
#build_request(resource, method, data = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cuecloud/cuecloud_request.rb', line 23 def build_request(resource, method, data=nil) url = build_url(resource) body = prepare_body(method, data) nonce = generate_nonce = nonce + url + body headers = { 'Access-Key' => api_key, 'Access-Signature' => signature(), 'Access-Nonce' => nonce, 'Content-Type' => 'application/json', } request_call(method, url, auth_key, headers, data) end |