Class: SoapyCake::Request
- Inherits:
-
Object
- Object
- SoapyCake::Request
- Defined in:
- lib/soapy_cake/request.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#time_offset ⇒ Object
Returns the value of attribute time_offset.
Instance Method Summary collapse
-
#initialize(role, service, method, opts = {}) ⇒ Request
constructor
A new instance of Request.
- #path ⇒ Object
- #short_response? ⇒ Boolean
- #xml ⇒ Object
Constructor Details
#initialize(role, service, method, opts = {}) ⇒ Request
Returns a new instance of Request.
6 7 8 9 10 11 |
# File 'lib/soapy_cake/request.rb', line 6 def initialize(role, service, method, opts = {}) @role = role.to_s @service = service.to_s @method = method.to_s @opts = opts end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/soapy_cake/request.rb', line 3 def api_key @api_key end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/soapy_cake/request.rb', line 4 def method @method end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
4 5 6 |
# File 'lib/soapy_cake/request.rb', line 4 def opts @opts end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
4 5 6 |
# File 'lib/soapy_cake/request.rb', line 4 def role @role end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
4 5 6 |
# File 'lib/soapy_cake/request.rb', line 4 def service @service end |
#time_offset ⇒ Object
Returns the value of attribute time_offset.
3 4 5 |
# File 'lib/soapy_cake/request.rb', line 3 def time_offset @time_offset end |
Instance Method Details
#path ⇒ Object
13 14 15 |
# File 'lib/soapy_cake/request.rb', line 13 def path "#{api_path}/#{service}.asmx" end |
#short_response? ⇒ Boolean
30 31 32 |
# File 'lib/soapy_cake/request.rb', line 30 def short_response? %w(addedit track).include?(service) end |
#xml ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/soapy_cake/request.rb', line 17 def xml Nokogiri::XML::Builder.new do |xml| xml['env'].Envelope(xml_namespaces) do xml.Header xml.Body do xml['cake'].send(method.camelize.to_sym) do xml_params(xml) end end end end.to_xml end |