Class: Smplkit::Management::AccountSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/smplkit/management/models.rb

Overview

An account-wide settings resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client = nil, id: nil, environment_order: nil, default_environment: nil, updated_at: nil) ⇒ AccountSettings

Returns a new instance of AccountSettings.



107
108
109
110
111
112
113
114
# File 'lib/smplkit/management/models.rb', line 107

def initialize(client = nil, id: nil, environment_order: nil,
               default_environment: nil, updated_at: nil)
  @client = client
  @id = id
  @environment_order = environment_order || []
  @default_environment = default_environment
  @updated_at = updated_at
end

Instance Attribute Details

#default_environmentObject

Returns the value of attribute default_environment.



105
106
107
# File 'lib/smplkit/management/models.rb', line 105

def default_environment
  @default_environment
end

#environment_orderObject

Returns the value of attribute environment_order.



105
106
107
# File 'lib/smplkit/management/models.rb', line 105

def environment_order
  @environment_order
end

#idObject

Returns the value of attribute id.



105
106
107
# File 'lib/smplkit/management/models.rb', line 105

def id
  @id
end

#updated_atObject

Returns the value of attribute updated_at.



105
106
107
# File 'lib/smplkit/management/models.rb', line 105

def updated_at
  @updated_at
end

Instance Method Details

#_apply(other) ⇒ Object



125
126
127
128
129
130
# File 'lib/smplkit/management/models.rb', line 125

def _apply(other)
  @id = other.id
  @environment_order = other.environment_order
  @default_environment = other.default_environment
  @updated_at = other.updated_at
end

#saveObject Also known as: save!



116
117
118
119
120
121
122
# File 'lib/smplkit/management/models.rb', line 116

def save
  raise "AccountSettings was constructed without a client; cannot save" if @client.nil?

  updated = @client.(self)
  _apply(updated)
  self
end