Class: AceClient::Json4

Inherits:
Base4 show all
Defined in:
lib/ace-client/json4.rb

Instance Attribute Summary

Attributes inherited from Base4

#body, #datetime, #headers, #region, #service

Attributes inherited from Base

#access_key_id, #endpoint, #http_method, #http_proxy, #last_response, #last_response_time, #secret_access_key, #use_ssl, #user_agent

Instance Method Summary collapse

Methods inherited from Base4

#add_authorization!, #execute, #execute_get, #execute_post, #initialize, #querystring

Methods inherited from Base

#endpoint_url, #initialize, #record_response, #set_http_proxy

Constructor Details

This class inherits a constructor from AceClient::Base4

Instance Method Details

#action(action, params = {}) ⇒ Object



9
10
11
# File 'lib/ace-client/json4.rb', line 9

def action(action, params={})
  create_request(action, params).perform
end

#create_request(action, params = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ace-client/json4.rb', line 13

def create_request(action, params={})
  @datetime = Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
  @params = params
  options = self.class.default_options.dup
  @body = options[:body] = @params.to_json

  @headers = {}
  headers['x-amz-target'] = "Hoge_20141213.#{action}"
  add_authorization!
  options[:headers] = headers

  HTTParty::Request.new(Net::HTTP::Post, endpoint_url + @path, options)
end

#dryrun(action, params = {}) ⇒ Object



5
6
7
# File 'lib/ace-client/json4.rb', line 5

def dryrun(action, params={})
  create_request(action, params)
end