Class: MoesifApi::EventModel
- Defined in:
- lib/moesif_api/models/event_model.rb
Instance Attribute Summary collapse
-
#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) ⇒ EventModel
constructor
A new instance of EventModel.
Methods inherited from BaseModel
Constructor Details
#initialize(request = nil, response = nil, session_token = nil, tags = nil, user_id = nil, company_id = nil, metadata = nil, direction = nil, weight = nil) ⇒ EventModel
Returns a new instance of EventModel.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/moesif_api/models/event_model.rb', line 58 def initialize(request = nil, response = nil, session_token = nil, = nil, user_id = nil, company_id = nil, = nil, direction = nil, weight = nil) @request = request @response = response @session_token = session_token = @user_id = user_id @company_id = company_id = @direction = direction @weight = weight end |
Instance Attribute Details
#company_id ⇒ String
company_id string
27 28 29 |
# File 'lib/moesif_api/models/event_model.rb', line 27 def company_id @company_id end |
#direction ⇒ String
direction string
35 36 37 |
# File 'lib/moesif_api/models/event_model.rb', line 35 def direction @direction end |
#metadata ⇒ Hash
metadata
31 32 33 |
# File 'lib/moesif_api/models/event_model.rb', line 31 def end |
#request ⇒ EventRequestModel
API request object
7 8 9 |
# File 'lib/moesif_api/models/event_model.rb', line 7 def request @request end |
#response ⇒ EventResponseModel
API response Object
11 12 13 |
# File 'lib/moesif_api/models/event_model.rb', line 11 def response @response end |
#session_token ⇒ String
End user’s auth/session token
15 16 17 |
# File 'lib/moesif_api/models/event_model.rb', line 15 def session_token @session_token end |
#tags ⇒ String
comma separated list of tags, see documentation
19 20 21 |
# File 'lib/moesif_api/models/event_model.rb', line 19 def end |
#user_id ⇒ String
End user’s user_id string from your app
23 24 25 |
# File 'lib/moesif_api/models/event_model.rb', line 23 def user_id @user_id end |
#weight ⇒ Integer
Weight of an API call
39 40 41 |
# File 'lib/moesif_api/models/event_model.rb', line 39 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/moesif_api/models/event_model.rb', line 79 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"] # Create object from extracted values EventModel.new(request, response, session_token, , user_id, company_id, , direction, weight) end end |
.names ⇒ Object
A mapping from model property names to API property names
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/moesif_api/models/event_model.rb', line 42 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" end @hash end |