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.



6070
6071
6072
6073
6074
# File 'lib/models/porcelain.rb', line 6070

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

Instance Attribute Details

#custom_headersObject

Entries, each describing a single header



6068
6069
6070
# File 'lib/models/porcelain.rb', line 6068

def custom_headers
  @custom_headers
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6076
6077
6078
6079
6080
6081
6082
# File 'lib/models/porcelain.rb', line 6076

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