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.



6055
6056
6057
6058
6059
# File 'lib/models/porcelain.rb', line 6055

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

Instance Attribute Details

#custom_headersObject

Entries, each describing a single header



6053
6054
6055
# File 'lib/models/porcelain.rb', line 6053

def custom_headers
  @custom_headers
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6061
6062
6063
6064
6065
6066
6067
# File 'lib/models/porcelain.rb', line 6061

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