Class: OpenSandbox::Endpoint

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

Overview

Value object for an Endpoint

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint

Returns:

  • (Object)

    the current value of endpoint



52
53
54
# File 'lib/open_sandbox/models.rb', line 52

def endpoint
  @endpoint
end

#headersObject (readonly)

Returns the value of attribute headers

Returns:

  • (Object)

    the current value of headers



52
53
54
# File 'lib/open_sandbox/models.rb', line 52

def headers
  @headers
end

Class Method Details

.from_hash(h) ⇒ Object



53
54
55
# File 'lib/open_sandbox/models.rb', line 53

def self.from_hash(h)
  new(endpoint: h["endpoint"], headers: h["headers"] || {})
end

Instance Method Details

#urlObject



57
# File 'lib/open_sandbox/models.rb', line 57

def url = endpoint.start_with?("http") ? endpoint : "http://#{endpoint}"