Class: Finlight::Company
- Inherits:
-
Object
- Object
- Finlight::Company
- Defined in:
- lib/finlight/models.rb
Overview
A company tagged in an article.
Instance Attribute Summary collapse
-
#company_id ⇒ Object
readonly
Returns the value of attribute company_id.
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#exchange ⇒ Object
readonly
Returns the value of attribute exchange.
-
#industry ⇒ Object
readonly
Returns the value of attribute industry.
-
#isin ⇒ Object
readonly
Returns the value of attribute isin.
-
#isins ⇒ Object
readonly
Returns the value of attribute isins.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#openfigi ⇒ Object
readonly
Returns the value of attribute openfigi.
-
#other_listings ⇒ Object
readonly
Returns the value of attribute other_listings.
-
#primary_listing ⇒ Object
readonly
Returns the value of attribute primary_listing.
-
#sector ⇒ Object
readonly
Returns the value of attribute sector.
-
#ticker ⇒ Object
readonly
Returns the value of attribute ticker.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(company_id:, name:, ticker:, confidence: nil, country: nil, exchange: nil, industry: nil, sector: nil, isin: nil, openfigi: nil, primary_listing: nil, isins: nil, other_listings: nil) ⇒ Company
constructor
A new instance of Company.
Constructor Details
#initialize(company_id:, name:, ticker:, confidence: nil, country: nil, exchange: nil, industry: nil, sector: nil, isin: nil, openfigi: nil, primary_listing: nil, isins: nil, other_listings: nil) ⇒ Company
Returns a new instance of Company.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/finlight/models.rb', line 46 def initialize(company_id:, name:, ticker:, confidence: nil, country: nil, exchange: nil, industry: nil, sector: nil, isin: nil, openfigi: nil, primary_listing: nil, isins: nil, other_listings: nil) @company_id = company_id @confidence = confidence @country = country @exchange = exchange @industry = industry @sector = sector @name = name @ticker = ticker @isin = isin @openfigi = openfigi @primary_listing = primary_listing @isins = isins @other_listings = other_listings end |
Instance Attribute Details
#company_id ⇒ Object (readonly)
Returns the value of attribute company_id.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def company_id @company_id end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def confidence @confidence end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def country @country end |
#exchange ⇒ Object (readonly)
Returns the value of attribute exchange.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def exchange @exchange end |
#industry ⇒ Object (readonly)
Returns the value of attribute industry.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def industry @industry end |
#isin ⇒ Object (readonly)
Returns the value of attribute isin.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def isin @isin end |
#isins ⇒ Object (readonly)
Returns the value of attribute isins.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def isins @isins end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def name @name end |
#openfigi ⇒ Object (readonly)
Returns the value of attribute openfigi.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def openfigi @openfigi end |
#other_listings ⇒ Object (readonly)
Returns the value of attribute other_listings.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def other_listings @other_listings end |
#primary_listing ⇒ Object (readonly)
Returns the value of attribute primary_listing.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def primary_listing @primary_listing end |
#sector ⇒ Object (readonly)
Returns the value of attribute sector.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def sector @sector end |
#ticker ⇒ Object (readonly)
Returns the value of attribute ticker.
43 44 45 |
# File 'lib/finlight/models.rb', line 43 def ticker @ticker end |
Class Method Details
.from_h(hash) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/finlight/models.rb', line 64 def self.from_h(hash) new( company_id: hash["companyId"], confidence: ModelParsing.to_float(hash["confidence"]), country: hash["country"], exchange: hash["exchange"], industry: hash["industry"], sector: hash["sector"], name: hash["name"], ticker: hash["ticker"], isin: hash["isin"], openfigi: hash["openfigi"], primary_listing: hash["primaryListing"] && Listing.from_h(hash["primaryListing"]), isins: ModelParsing.to_string_list(hash["isins"]), other_listings: hash["otherListings"]&.map { |l| Listing.from_h(l) } ) end |