Class: SDM::CustomHeaders

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

CustomHeaders holds an array of HTTP headers to be injected into requests by the driver

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(custom_headers: nil) ⇒ CustomHeaders

Returns a new instance of CustomHeaders.



5763
5764
5765
5766
5767
# File 'lib/models/porcelain.rb', line 5763

def initialize(
  custom_headers: nil
)
  @custom_headers = custom_headers == nil ? [] : custom_headers
end

Instance Attribute Details

#custom_headersObject

Entries, each describing a single header



5761
5762
5763
# File 'lib/models/porcelain.rb', line 5761

def custom_headers
  @custom_headers
end

Instance Method Details

#to_json(options = {}) ⇒ Object



5769
5770
5771
5772
5773
5774
5775
# File 'lib/models/porcelain.rb', line 5769

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end