SdkSessionBase

SdkSessionBase

Version 1.6 - Updated on 03/23/2017

Contents

Direct Known Subclasses

Constructor Details

#initialize(locale) ⇒ SdkSessionBase

Returns a new instance of SdkSessionBase.

 def initialize(locale)
      @locale = locale
    end
    

Instance Attribute Details

locale

#locale=(value) ⇒ Object (writeonly)

Sets the attribute locale.

  • Parameters:
    • value — Value to which the attribute locale is set to.

Instance Method Details

do_delete_with_params

#do_delete_with_params(path, params = nil, server = :api) ⇒ Object

 def do_delete_with_params(path, params=nil, server=:api)  # :nodoc:
      params ||= {}
      assert_authorized
      uri = build_url_with_params(path, params, server)
      do_http(uri, Net::HTTP::Delete.new(uri.request_uri))
    end
    

do_delete_without_params

#do_delete_without_params(path, server = :api) ⇒ Object

 def do_delete_without_params(path, server=:api)  # :nodoc:
      assert_authorized
      uri = build_url(path, server)
      do_http(uri, Net::HTTP::Delete.new(uri.request_uri))
    end
    

do_get

#do_get(path, params = nil, server = :api) ⇒ Object

 def do_get(path, params=nil, server=:api)  # :nodoc:
      params ||= {}
      assert_authorized
      uri = build_url_with_params(path, params, server)
      do_http(uri, Net::HTTP::Get.new(uri.request_uri))
    end
    

do_get_without_params

#do_get_without_params(path, server = :api) ⇒ Object

 def do_get_without_params(path, server=:api)  # :nodoc:
      assert_authorized
      uri = build_url(path, server)
      do_http(uri, Net::HTTP::Get.new(uri.request_uri))
    end
    

do_http_with_body

#do_http_with_body(uri, request, body) ⇒ Object

 def do_http_with_body(uri, request, body)
      if body != nil
        if body.is_a?(Hash)
          request.set_form_data(Sdk::clean_params(body))
        elsif body.respond_to?(:read)
          if body.respond_to?(:length)
            request["Content-Length"] = body.length.to_s
          elsif body.respond_to?(:stat) && body.stat.respond_to?(:size)
            request["Content-Length"] = body.stat.size.to_s
          else
            raise ArgumentError, "Don't know how to handle 'body' (responds to 'read' but not to 'length' or 'stat.size')."
          end
          request.body_stream = body
        else
          s = body.to_s
          request["Content-Length"] = s.length
          request.body = s
        end
      end
      do_http(uri, request)
    end
    

do_post

#do_post(path, params = nil, headers = nil, server = :api) ⇒ Object

 def do_post(path, params=nil, headers=nil, server=:api)  # :nodoc:
      params ||= {}
      assert_authorized
      uri = build_url(path, server)
      do_http_with_body(uri, Net::HTTP::Post.new(uri.request_uri, headers), params)
    end
    

do_post_with_body

#do_post_with_body(path, params = nil, headers = nil, body = nil, server = :api) ⇒ Object

 def do_post_with_body(path, params=nil, headers=nil, body=nil, server=:api)  # :nodoc:
      params ||= {}
      assert_authorized
      uri = build_url_with_params(path, params, server)    
      do_http_with_body(uri, Net::HTTP::Post.new(uri.request_uri, headers), body)
    end
    

do_post_without_params

#do_post_without_params(path, headers = nil, server = :api) ⇒ Object

 def do_post_without_params(path, headers=nil, server=:api)  # :nodoc:
      assert_authorized
      uri = build_url(path, server)
      do_http(uri, Net::HTTP::Post.new(uri.request_uri, headers))
    end
    

do_put

#do_put(path, params = nil, headers = nil, body = nil, server = :api) ⇒ Object

 def do_put(path, params=nil, headers=nil, body=nil, server=:api)  # :nodoc:
      params ||= {}
      assert_authorized
      uri = build_url(path, server)
      do_http_with_body(uri, Net::HTTP::Put.new(uri.request_uri, headers), params)
    end
    

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.