Sha256: 6bb5f586c46b92cc9438cb40a7c6b72ccfcf342507c280a3b5980a7547d386c3
Contents?: true
Size: 1.63 KB
Versions: 3
Compression:
Stored size: 1.63 KB
Contents
# frozen_string_literal: true module Soaspec # Models a request made to a REST API class RestRequest # @example GET method # :get # @return [Symbol] REST method used attr_accessor :method # @example JSON body # {"test":5} # @return [String] Body of request sent attr_accessor :body # @return [String] Name given to test to describe it attr_accessor :test_name # @return [String] User used in basic auth attr_accessor :basic_auth_user # @return [String] Password used in basic auth attr_accessor :basic_auth_password # @return [String] Url appended to base_url attr_accessor :suburl # @return [Hash] Miscellaneous parameters attr_accessor :other_params # Headers. Keys that are `symbols` will be converted from `snake_case` to `Word-Word2` # @return [Hash] Headers sent as part of request attr_accessor :headers def initialize(overall, options, body) overall_params = overall.dup # Must duplicate hash as deletion occurring self.body = body self.method = overall_params.delete(:method) self.suburl = overall_params.delete(:suburl) self.test_name = overall_params.delete(:name) self.other_params = overall_params self.basic_auth_user = options[:user] self.basic_auth_password = options[:password] self.headers = options[:headers] end # @param [String, Symbol] value Message to send to object retrieving a value # @return [Object] Result of retrieving value def [](value) send(value) end # @return [String] Show inspection of all parameters def to_s inspect end end end
Version data entries
3 entries across 3 versions & 1 rubygems