Class: MoesifApi::CompanyModel
- Defined in:
- lib/moesif_api/models/company_model.rb
Instance Attribute Summary collapse
-
#campaign ⇒ CampaignModel
campaign object.
-
#company_domain ⇒ String
Optionally tag the company with the company domain.
-
#company_id ⇒ String
company id of the company.
-
#ip_address ⇒ String
ip address associated with user if avaialble.
-
#metadata ⇒ Object
meta data.
-
#modified_time ⇒ DateTime
Time when modification was made.
-
#session_token ⇒ String
session token associated with user if avaialble.
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(company_id = nil, modified_time = nil, ip_address = nil, session_token = nil, company_domain = nil, metadata = nil, campaign = nil) ⇒ CompanyModel
constructor
A new instance of CompanyModel.
Methods inherited from BaseModel
#clean_str, #to_hash, #to_json
Constructor Details
#initialize(company_id = nil, modified_time = nil, ip_address = nil, session_token = nil, company_domain = nil, metadata = nil, campaign = nil) ⇒ CompanyModel
Returns a new instance of CompanyModel.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/moesif_api/models/company_model.rb', line 50 def initialize(company_id = nil, modified_time = nil, ip_address = nil, session_token = nil, company_domain = nil, = nil, campaign = nil) @company_id = company_id @modified_time = modified_time @ip_address = ip_address @session_token = session_token @company_domain = company_domain @metadata = @campaign = campaign end |
Instance Attribute Details
#campaign ⇒ CampaignModel
campaign object
33 34 35 |
# File 'lib/moesif_api/models/company_model.rb', line 33 def campaign @campaign end |
#company_domain ⇒ String
Optionally tag the company with the company domain.
25 26 27 |
# File 'lib/moesif_api/models/company_model.rb', line 25 def company_domain @company_domain end |
#company_id ⇒ String
company id of the company
9 10 11 |
# File 'lib/moesif_api/models/company_model.rb', line 9 def company_id @company_id end |
#ip_address ⇒ String
ip address associated with user if avaialble.
17 18 19 |
# File 'lib/moesif_api/models/company_model.rb', line 17 def ip_address @ip_address end |
#metadata ⇒ Object
meta data
29 30 31 |
# File 'lib/moesif_api/models/company_model.rb', line 29 def @metadata end |
#modified_time ⇒ DateTime
Time when modification was made. default to current time on server side.
13 14 15 |
# File 'lib/moesif_api/models/company_model.rb', line 13 def modified_time @modified_time end |
#session_token ⇒ String
session token associated with user if avaialble.
21 22 23 |
# File 'lib/moesif_api/models/company_model.rb', line 21 def session_token @session_token end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/moesif_api/models/company_model.rb', line 67 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash company_id = hash["company_id"] modified_time = DateTime.iso8601(hash["modified_time"]) if hash["modified_time"] ip_address = hash["ip_address"] session_token = hash["session_token"] company_domain = hash["company_domain"] = hash["metadata"] campaign = CampaignModel.from_hash(hash["campaign"]) if hash["campaign"] # Create object from extracted values CompanyModel.new(company_id, modified_time, ip_address, session_token, company_domain, , campaign) end end |
.names ⇒ Object
A mapping from model property names to API property names
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/moesif_api/models/company_model.rb', line 36 def self.names if @hash.nil? @hash = {} @hash["company_id"] = "company_id" @hash["modified_time"] = "modified_time" @hash["ip_address"] = "ip_address" @hash["session_token"] = "session_token" @hash["company_domain"] = "company_domain" @hash["metadata"] = "metadata" @hash["campaign"] = "campaign" end @hash end |