Class: MastercardCoreSdk::Core::QueryParams
- Inherits:
-
Object
- Object
- MastercardCoreSdk::Core::QueryParams
- Defined in:
- lib/mastercard_core_sdk/core/query_params.rb
Overview
Container for query string data used to make service request url.
Instance Attribute Summary collapse
-
#params ⇒ Hash
readonly
Gets the query string parameters.
Instance Method Summary collapse
-
#add(key, value) ⇒ Object
Merge query string parameters as key,value pair into params hash.
-
#initialize ⇒ QueryParams
constructor
A new instance of QueryParams.
Constructor Details
#initialize ⇒ QueryParams
Returns a new instance of QueryParams.
8 9 10 |
# File 'lib/mastercard_core_sdk/core/query_params.rb', line 8 def initialize @params = {} end |
Instance Attribute Details
#params ⇒ Hash (readonly)
Gets the query string parameters.
26 27 28 |
# File 'lib/mastercard_core_sdk/core/query_params.rb', line 26 def params @params end |
Instance Method Details
#add(key, value) ⇒ Object
Merge query string parameters as key,value pair into params hash.
17 18 19 20 21 |
# File 'lib/mastercard_core_sdk/core/query_params.rb', line 17 def add(key, value) key = key.to_sym if key.is_a?(String) @params.merge!({ key => value }) return self end |