Class: Appwrite::Models::WafRuleChallenge

Inherits:
Object
  • Object
show all
Defined in:
lib/appwrite/models/waf_rule_challenge.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created_at:, updated_at:, name:, description:, team_id:, project_id:, resource_type:, resource_id:, action:, priority:, enabled:, conditions:, config:, schedule: nil, challenge_type:, difficulty:, ttl:) ⇒ WafRuleChallenge

Returns a new instance of WafRuleChallenge.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 25

def initialize(
    id:,
    created_at:,
    updated_at:,
    name:,
    description:,
    team_id:,
    project_id:,
    resource_type:,
    resource_id:,
    action:,
    priority:,
    enabled:,
    conditions:,
    config:,
    schedule: nil,
    challenge_type:,
    difficulty:,
    ttl:
)
    @id = id
    @created_at = created_at
    @updated_at = updated_at
    @name = name
    @description = description
    @team_id = team_id
    @project_id = project_id
    @resource_type = resource_type
    @resource_id = resource_id
    @action = validate_action(action)
    @priority = priority
    @enabled = enabled
    @conditions = conditions
    @config = config
    @schedule = schedule
    @challenge_type = challenge_type
    @difficulty = difficulty
    @ttl = ttl
end

Instance Attribute Details

#action ⇒ Object (readonly)

Returns the value of attribute action.



15
16
17
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 15

def action
  @action
end

#challenge_type ⇒ Object (readonly)

Returns the value of attribute challenge_type.



21
22
23
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 21

def challenge_type
  @challenge_type
end

#conditions ⇒ Object (readonly)

Returns the value of attribute conditions.



18
19
20
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 18

def conditions
  @conditions
end

#config ⇒ Object (readonly)

Returns the value of attribute config.



19
20
21
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 19

def config
  @config
end

#created_at ⇒ Object (readonly)

Returns the value of attribute created_at.



7
8
9
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 7

def created_at
  @created_at
end

#description ⇒ Object (readonly)

Returns the value of attribute description.



10
11
12
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 10

def description
  @description
end

#difficulty ⇒ Object (readonly)

Returns the value of attribute difficulty.



22
23
24
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 22

def difficulty
  @difficulty
end

#enabled ⇒ Object (readonly)

Returns the value of attribute enabled.



17
18
19
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 17

def enabled
  @enabled
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 6

def id
  @id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 9

def name
  @name
end

#priority ⇒ Object (readonly)

Returns the value of attribute priority.



16
17
18
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 16

def priority
  @priority
end

#project_id ⇒ Object (readonly)

Returns the value of attribute project_id.



12
13
14
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 12

def project_id
  @project_id
end

#resource_id ⇒ Object (readonly)

Returns the value of attribute resource_id.



14
15
16
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 14

def resource_id
  @resource_id
end

#resource_type ⇒ Object (readonly)

Returns the value of attribute resource_type.



13
14
15
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 13

def resource_type
  @resource_type
end

#schedule ⇒ Object (readonly)

Returns the value of attribute schedule.



20
21
22
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 20

def schedule
  @schedule
end

#team_id ⇒ Object (readonly)

Returns the value of attribute team_id.



11
12
13
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 11

def team_id
  @team_id
end

#ttl ⇒ Object (readonly)

Returns the value of attribute ttl.



23
24
25
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 23

def ttl
  @ttl
end

#updated_at ⇒ Object (readonly)

Returns the value of attribute updated_at.



8
9
10
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 8

def updated_at
  @updated_at
end

Class Method Details

.from(map:) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 65

def self.from(map:)
    map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "name" => "", "description" => "", "teamId" => "", "projectId" => "", "resourceType" => "api", "resourceId" => "", "priority" => 0, "enabled" => true, "conditions" => [], "config" => {}, "challengeType" => "compute", "difficulty" => 3, "ttl" => 1800 }.merge(map)
    WafRuleChallenge.new(
        id: map["$id"],
        created_at: map["$createdAt"],
        updated_at: map["$updatedAt"],
        name: map["name"],
        description: map["description"],
        team_id: map["teamId"],
        project_id: map["projectId"],
        resource_type: map["resourceType"],
        resource_id: map["resourceId"],
        action: map["action"],
        priority: map["priority"],
        enabled: map["enabled"],
        conditions: map["conditions"],
        config: map["config"],
        schedule: map["schedule"],
        challenge_type: map["challengeType"],
        difficulty: map["difficulty"],
        ttl: map["ttl"]
    )
end

Instance Method Details

#to_map ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/appwrite/models/waf_rule_challenge.rb', line 89

def to_map
    {
        "$id": @id,
        "$createdAt": @created_at,
        "$updatedAt": @updated_at,
        "name": @name,
        "description": @description,
        "teamId": @team_id,
        "projectId": @project_id,
        "resourceType": @resource_type,
        "resourceId": @resource_id,
        "action": @action,
        "priority": @priority,
        "enabled": @enabled,
        "conditions": @conditions,
        "config": @config,
        "schedule": @schedule,
        "challengeType": @challenge_type,
        "difficulty": @difficulty,
        "ttl": @ttl
    }
end