Class: Appwrite::Models::UsageEvent

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric:, value:, time:, xpath:, method:, status:, resource_type:, resource_id:, country_code:, user_agent:) ⇒ UsageEvent

Returns a new instance of UsageEvent.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/appwrite/models/usage_event.rb', line 17

def initialize(
    metric:,
    value:,
    time:,
    xpath:,
    method:,
    status:,
    resource_type:,
    resource_id:,
    country_code:,
    user_agent:
)
    @metric = metric
    @value = value
    @time = time
    @xpath = xpath
    @method = method
    @status = status
    @resource_type = resource_type
    @resource_id = resource_id
    @country_code = country_code
    @user_agent = user_agent
end

Instance Attribute Details

#country_codeObject (readonly)

Returns the value of attribute country_code.



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

def country_code
  @country_code
end

#methodObject (readonly)

Returns the value of attribute method.



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

def method
  @method
end

#metricObject (readonly)

Returns the value of attribute metric.



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

def metric
  @metric
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



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

def resource_id
  @resource_id
end

#resource_typeObject (readonly)

Returns the value of attribute resource_type.



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

def resource_type
  @resource_type
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#timeObject (readonly)

Returns the value of attribute time.



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

def time
  @time
end

#user_agentObject (readonly)

Returns the value of attribute user_agent.



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

def user_agent
  @user_agent
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

#xpathObject (readonly)

Returns the value of attribute xpath.



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

def xpath
  @xpath
end

Class Method Details

.from(map:) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/appwrite/models/usage_event.rb', line 41

def self.from(map:)
    UsageEvent.new(
        metric: map["metric"],
        value: map["value"],
        time: map["time"],
        xpath: map["path"],
        method: map["method"],
        status: map["status"],
        resource_type: map["resourceType"],
        resource_id: map["resourceId"],
        country_code: map["countryCode"],
        user_agent: map["userAgent"]
    )
end

Instance Method Details

#to_mapObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/appwrite/models/usage_event.rb', line 56

def to_map
    {
        "metric": @metric,
        "value": @value,
        "time": @time,
        "path": @xpath,
        "method": @method,
        "status": @status,
        "resourceType": @resource_type,
        "resourceId": @resource_id,
        "countryCode": @country_code,
        "userAgent": @user_agent
    }
end