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.



48
49
50
51
52
# File 'lib/change_health.rb', line 48

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

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



46
47
48
# File 'lib/change_health.rb', line 46

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



46
47
48
# File 'lib/change_health.rb', line 46

def client_secret
  @client_secret
end

#grant_typeObject

Returns the value of attribute grant_type.



46
47
48
# File 'lib/change_health.rb', line 46

def grant_type
  @grant_type
end

Instance Method Details

#api_endpointObject



58
59
60
# File 'lib/change_health.rb', line 58

def api_endpoint
  Connection.base_uri
end

#api_endpoint=(endpoint) ⇒ Object



54
55
56
# File 'lib/change_health.rb', line 54

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

#from_h(h) ⇒ Object



71
72
73
74
75
76
77
78
# File 'lib/change_health.rb', line 71

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

  self
end

#to_hObject



62
63
64
65
66
67
68
69
# File 'lib/change_health.rb', line 62

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