Class: ZeusSdk::V1::Permission

Inherits:
Object
  • Object
show all
Defined in:
lib/zeus_sdk/v1/models/auth/permission.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Permission

Returns a new instance of Permission.



5
6
7
8
9
10
11
12
13
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 5

def initialize(raw)
    return if raw.blank?
    self.raw = raw
    self.id = raw["id"]
    self.role_id = raw["role_id"]
    self.name = raw["name"] if raw.has_key?("name")
    self.created_at = raw["created_at"] if raw.has_key?("created_at")
    self.updated_at = raw["updated_at"] if raw.has_key?("updated_at")
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 3

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 3

def name
  @name
end

#rawObject

Returns the value of attribute raw.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 3

def raw
  @raw
end

#role_idObject

Returns the value of attribute role_id.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 3

def role_id
  @role_id
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 3

def updated_at
  @updated_at
end

Instance Method Details

#as_json(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 15

def as_json(options={})
    {
        id: self.id,
        role_id: self.role_id,
        name: self.name,
        created_at: self.created_at,
        updated_at: self.updated_at
    }
end

#to_json(options = {}) ⇒ Object



25
26
27
# File 'lib/zeus_sdk/v1/models/auth/permission.rb', line 25

def to_json(options={})
    self.as_json(options).to_json
end