Class: MoesifApi::EventModel
- Defined in:
- lib/moesif_api/models/event_model.rb
Instance Attribute Summary collapse
-
#blocked_by ⇒ Integer
Blocked by in case of governance rule of an API call.
-
#company_id ⇒ String
company_id string.
-
#direction ⇒ String
direction string.
-
#metadata ⇒ Hash
metadata.
-
#request ⇒ EventRequestModel
API request object.
-
#response ⇒ EventResponseModel
API response Object.
-
#session_token ⇒ String
End user’s auth/session token.
-
#tags ⇒ String
comma separated list of tags, see documentation.
-
#user_id ⇒ String
End user’s user_id string from your app.
-
#weight ⇒ Integer
Weight of an API call.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(request = nil, response = nil, session_token = nil, tags = nil, user_id = nil, company_id = nil, metadata = nil, direction = nil, weight = nil, blocked_by = nil) ⇒ EventModel
constructor
A new instance of EventModel.
Methods inherited from BaseModel
#clean_str, #to_hash, #to_json
Constructor Details
#initialize(request = nil, response = nil, session_token = nil, tags = nil, user_id = nil, company_id = nil, metadata = nil, direction = nil, weight = nil, blocked_by = nil) ⇒ EventModel
Returns a new instance of EventModel.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/moesif_api/models/event_model.rb', line 61 def initialize(request = nil, response = nil, session_token = nil, = nil, user_id = nil, company_id = nil, = nil, direction = nil, weight = nil, blocked_by = nil) @request = request @response = response @session_token = session_token @tags = @user_id = user_id @company_id = company_id @metadata = @direction = direction @weight = weight @blocked_by = blocked_by end |
Instance Attribute Details
#blocked_by ⇒ Integer
Blocked by in case of governance rule of an API call
41 42 43 |
# File 'lib/moesif_api/models/event_model.rb', line 41 def blocked_by @blocked_by end |
#company_id ⇒ String
company_id string
25 26 27 |
# File 'lib/moesif_api/models/event_model.rb', line 25 def company_id @company_id end |
#direction ⇒ String
direction string
33 34 35 |
# File 'lib/moesif_api/models/event_model.rb', line 33 def direction @direction end |
#metadata ⇒ Hash
metadata
29 30 31 |
# File 'lib/moesif_api/models/event_model.rb', line 29 def @metadata end |
#request ⇒ EventRequestModel
API request object
5 6 7 |
# File 'lib/moesif_api/models/event_model.rb', line 5 def request @request end |
#response ⇒ EventResponseModel
API response Object
9 10 11 |
# File 'lib/moesif_api/models/event_model.rb', line 9 def response @response end |
#session_token ⇒ String
End user’s auth/session token
13 14 15 |
# File 'lib/moesif_api/models/event_model.rb', line 13 def session_token @session_token end |
#tags ⇒ String
comma separated list of tags, see documentation
17 18 19 |
# File 'lib/moesif_api/models/event_model.rb', line 17 def @tags end |
#user_id ⇒ String
End user’s user_id string from your app
21 22 23 |
# File 'lib/moesif_api/models/event_model.rb', line 21 def user_id @user_id end |
#weight ⇒ Integer
Weight of an API call
37 38 39 |
# File 'lib/moesif_api/models/event_model.rb', line 37 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/moesif_api/models/event_model.rb', line 84 def self.from_hash(hash) if hash.nil? nil else # Extract variables from the hash request = EventRequestModel.from_hash(hash['request']) if hash['request'] response = EventResponseModel.from_hash(hash['response']) if hash['response'] session_token = hash['session_token'] = hash['tags'] user_id = hash['user_id'] company_id = hash['company_id'] = hash['metadata'] direction = hash['direction'] weight = hash['weight'] blocked_by = hash['blocked_by'] # Create object from extracted values EventModel.new(request, response, session_token, , user_id, company_id, , direction, weight, blocked_by) end end |
.names ⇒ Object
A mapping from model property names to API property names
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/moesif_api/models/event_model.rb', line 44 def self.names if @hash.nil? @hash = {} @hash['request'] = 'request' @hash['response'] = 'response' @hash['session_token'] = 'session_token' @hash['tags'] = 'tags' @hash['user_id'] = 'user_id' @hash['company_id'] = 'company_id' @hash['metadata'] = 'metadata' @hash['direction'] = 'direction' @hash['weight'] = 'weight' @hash['blocked_by'] = 'blocked_by' end @hash end |