Class: Authlete::Model::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/authlete/model/scope.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defaultEntryObject Also known as: default_entry

The flag to indicate whether this scope is included in the default scope set. (boolean)



32
33
34
# File 'lib/authlete/model/scope.rb', line 32

def defaultEntry
  @defaultEntry
end

#descriptionObject

The description about this scope. (String)



25
26
27
# File 'lib/authlete/model/scope.rb', line 25

def description
  @description
end

#nameObject

The name of this scope. (String)



28
29
30
# File 'lib/authlete/model/scope.rb', line 28

def name
  @name
end

Class Method Details

.parse(hash) ⇒ Object

Construct an instance from the given hash.

If the given argument is nil or is not a Hash, nil is returned. Otherwise, Scope.new(hash) is returned.



103
104
105
106
107
108
109
# File 'lib/authlete/model/scope.rb', line 103

def self.parse(hash)
  if hash.nil? or (hash.kind_of?(Hash) == false)
    return nil
  end

  return Authlete::Model::Scope.new(hash)
end

Instance Method Details

#[](key) ⇒ Object



130
131
132
133
134
135
136
137
138
# File 'lib/authlete/model/scope.rb', line 130

def [](key)
  key = authlete_model_scope_to_key(key)

  if respond_to?(key)
    return send(key)
  else
    return nil
  end
end

#[]=(key, value) ⇒ Object



140
141
142
143
144
145
146
147
148
149
# File 'lib/authlete/model/scope.rb', line 140

def []=(key, value)
  key = authlete_model_scope_to_key(key)
  method = "#{key}="

  if respond_to?(method)
    return send(method, value)
  else
    return nil
  end
end

#to_hashObject

Convert this object into a hash.



117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/authlete/model/scope.rb', line 117

def to_hash
  hash = {}

  instance_variables.each do |var|
    key = var.to_s.delete("@").to_sym
    val = instance_variable_get(var)

    hash[key] = val
  end

  return hash
end

#update(hash) ⇒ Object

Set attribute values using the given hash.



112
113
114
# File 'lib/authlete/model/scope.rb', line 112

def update(hash)
  authlete_model_scope_update(hash)
end