Class: Faraday::Utils::ParamsHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/faraday/utils.rb

Overview

hash with stringified keys

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



90
91
92
# File 'lib/faraday/utils.rb', line 90

def [](key)
  super(convert_key(key))
end

#[]=(key, value) ⇒ Object



94
95
96
# File 'lib/faraday/utils.rb', line 94

def []=(key, value)
  super(convert_key(key), value)
end

#delete(key) ⇒ Object



98
99
100
# File 'lib/faraday/utils.rb', line 98

def delete(key)
  super(convert_key(key))
end

#include?(key) ⇒ Boolean Also known as: has_key?, member?, key?



102
103
104
# File 'lib/faraday/utils.rb', line 102

def include?(key)
  super(convert_key(key))
end

#merge(params) ⇒ Object



118
119
120
# File 'lib/faraday/utils.rb', line 118

def merge(params)
  dup.update(params)
end

#merge_query(query) ⇒ Object



127
128
129
130
131
132
# File 'lib/faraday/utils.rb', line 127

def merge_query(query)
  if query && !query.empty?
    update Utils.parse_query(query)
  end
  self
end

#replace(other) ⇒ Object



122
123
124
125
# File 'lib/faraday/utils.rb', line 122

def replace(other)
  clear
  update(other)
end

#to_queryObject



134
135
136
# File 'lib/faraday/utils.rb', line 134

def to_query
  Utils.build_nested_query(self)
end

#update(params) ⇒ Object Also known as: merge!



110
111
112
113
114
115
# File 'lib/faraday/utils.rb', line 110

def update(params)
  params.each do |key, value|
    self[key] = value
  end
  self
end