Class: ChangeHealth::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



67
68
69
70
71
72
73
# File 'lib/change_health.rb', line 67

def initialize
  @auth_headers  = nil
  @client_id     = nil
  @client_secret = nil
  @endpoints     = nil
  @grant_type    = :client_credentials
end

Instance Attribute Details

#auth_headersObject

Returns the value of attribute auth_headers.



65
66
67
# File 'lib/change_health.rb', line 65

def auth_headers
  @auth_headers
end

#client_idObject

Returns the value of attribute client_id.



65
66
67
# File 'lib/change_health.rb', line 65

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



65
66
67
# File 'lib/change_health.rb', line 65

def client_secret
  @client_secret
end

#endpointsObject

Returns the value of attribute endpoints.



65
66
67
# File 'lib/change_health.rb', line 65

def endpoints
  @endpoints
end

#grant_typeObject

Returns the value of attribute grant_type.



65
66
67
# File 'lib/change_health.rb', line 65

def grant_type
  @grant_type
end

Instance Method Details

#api_endpointObject



79
80
81
# File 'lib/change_health.rb', line 79

def api_endpoint
  Connection.base_uri
end

#api_endpoint=(endpoint) ⇒ Object



75
76
77
# File 'lib/change_health.rb', line 75

def api_endpoint=(endpoint)
  Connection.base_uri(endpoint.freeze)
end

#from_h(h) ⇒ Object



94
95
96
97
98
99
100
101
102
103
# File 'lib/change_health.rb', line 94

def from_h(h)
  self.auth_headers  = h[:auth_headers]
  self.client_id     = h[:client_id]
  self.client_secret = h[:client_secret]
  self.endpoints     = h[:endpoints]
  self.grant_type    = h[:grant_type]
  self.api_endpoint  = h[:api_endpoint]

  self
end

#to_hObject



83
84
85
86
87
88
89
90
91
92
# File 'lib/change_health.rb', line 83

def to_h
  {
    auth_headers: @auth_headers,
    client_id: @client_id,
    client_secret: @client_secret,
    endpoints: @endpoints,
    grant_type: @grant_type,
    api_endpoint: api_endpoint
  }
end