Class: NNEClient::Result
- Inherits:
-
Object
- Object
- NNEClient::Result
- Defined in:
- lib/nne_client/result.rb
Overview
The Result is used to represent a single result from a result set. It can be seen roughly as an NNE CompanyBasic object. It provides transparent loading of attributes from the NNE Company object. It also provides methods for navigating the API further.
The Result can be instantiated with either a full result hash from an API query or with just a tdc_id in which case the attributes will be lazy loaded from the API.
Instance Attribute Summary collapse
- #ad_protection ⇒ Object readonly
- #cvr_no ⇒ Object readonly
- #district ⇒ Object readonly
- #email ⇒ Object readonly
- #founded_year ⇒ Object readonly
- #homepage ⇒ Object readonly
- #number_of_employees ⇒ Object readonly
- #official_name ⇒ Object readonly
- #p_no ⇒ Object readonly
- #phone ⇒ Object readonly
- #status_text ⇒ Object readonly
- #street ⇒ Object readonly
- #tdf_name ⇒ Object readonly
- #zip_code ⇒ Object readonly
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#additional_names ⇒ Object
List of additional_names.
-
#associates ⇒ Object
List of associates.
- #eql?(other) ⇒ Boolean
-
#finances ⇒ Object
List of finance records.
- #hash ⇒ Object
- #house_no ⇒ Object
-
#ownerships ⇒ Object
List of ownerships.
-
#subsidiaries ⇒ Object
List of subsidiaries.
-
#trades ⇒ Object
List of trades.
Instance Attribute Details
#ad_protection ⇒ Object (readonly)
51 52 |
# File 'lib/nne_client/result.rb', line 51 basic_attributes :cvr_no, :p_no, :district, :phone, :street, :zip_code, :official_name, :ad_protection |
#cvr_no ⇒ Object (readonly)
51 52 |
# File 'lib/nne_client/result.rb', line 51 basic_attributes :cvr_no, :p_no, :district, :phone, :street, :zip_code, :official_name, :ad_protection |
#district ⇒ Object (readonly)
51 52 |
# File 'lib/nne_client/result.rb', line 51 basic_attributes :cvr_no, :p_no, :district, :phone, :street, :zip_code, :official_name, :ad_protection |
#email ⇒ Object (readonly)
60 61 |
# File 'lib/nne_client/result.rb', line 60 extended_attributes :email, :homepage, :founded_year, :number_of_employees, :tdf_name, :status_text |
#founded_year ⇒ Object (readonly)
60 61 |
# File 'lib/nne_client/result.rb', line 60 extended_attributes :email, :homepage, :founded_year, :number_of_employees, :tdf_name, :status_text |
#homepage ⇒ Object (readonly)
60 61 |
# File 'lib/nne_client/result.rb', line 60 extended_attributes :email, :homepage, :founded_year, :number_of_employees, :tdf_name, :status_text |
#number_of_employees ⇒ Object (readonly)
60 61 |
# File 'lib/nne_client/result.rb', line 60 extended_attributes :email, :homepage, :founded_year, :number_of_employees, :tdf_name, :status_text |
#official_name ⇒ Object (readonly)
51 52 |
# File 'lib/nne_client/result.rb', line 51 basic_attributes :cvr_no, :p_no, :district, :phone, :street, :zip_code, :official_name, :ad_protection |
#p_no ⇒ Object (readonly)
51 52 |
# File 'lib/nne_client/result.rb', line 51 basic_attributes :cvr_no, :p_no, :district, :phone, :street, :zip_code, :official_name, :ad_protection |
#phone ⇒ Object (readonly)
51 52 |
# File 'lib/nne_client/result.rb', line 51 basic_attributes :cvr_no, :p_no, :district, :phone, :street, :zip_code, :official_name, :ad_protection |
#status_text ⇒ Object (readonly)
60 61 |
# File 'lib/nne_client/result.rb', line 60 extended_attributes :email, :homepage, :founded_year, :number_of_employees, :tdf_name, :status_text |
#street ⇒ Object (readonly)
51 52 |
# File 'lib/nne_client/result.rb', line 51 basic_attributes :cvr_no, :p_no, :district, :phone, :street, :zip_code, :official_name, :ad_protection |
#tdf_name ⇒ Object (readonly)
60 61 |
# File 'lib/nne_client/result.rb', line 60 extended_attributes :email, :homepage, :founded_year, :number_of_employees, :tdf_name, :status_text |
#zip_code ⇒ Object (readonly)
51 52 |
# File 'lib/nne_client/result.rb', line 51 basic_attributes :cvr_no, :p_no, :district, :phone, :street, :zip_code, :official_name, :ad_protection |
Instance Method Details
#==(other) ⇒ Object
123 124 125 |
# File 'lib/nne_client/result.rb', line 123 def ==(other) other.tdc_id == tdc_id end |
#additional_names ⇒ Object
List of additional_names
68 69 70 71 |
# File 'lib/nne_client/result.rb', line 68 def additional_names result = Fetch.new(tdc_id, :fetch_company_additional_names).result_set.to_hash Array(result[:array_ofstring][:item]) end |
#associates ⇒ Object
List of associates
84 85 86 87 88 89 90 91 |
# File 'lib/nne_client/result.rb', line 84 def associates subsidiaries = fetch_associates if subsidiaries.kind_of?(Hash) [Subsidiary.new(subsidiaries)] else subsidiaries.map{|subsidiary| Subsidiary.new(subsidiary) } end end |
#eql?(other) ⇒ Boolean
131 132 133 |
# File 'lib/nne_client/result.rb', line 131 def eql?(other) hash == other.hash end |
#finances ⇒ Object
List of finance records
114 115 116 117 118 119 120 121 |
# File 'lib/nne_client/result.rb', line 114 def finances finances = fetch_finances if finances.kind_of?(Hash) [Finance.new(finances)] else finances.map{|finance| Finance.new(finance) } end end |
#hash ⇒ Object
127 128 129 |
# File 'lib/nne_client/result.rb', line 127 def hash tdc_id.hash end |
#house_no ⇒ Object
63 64 65 |
# File 'lib/nne_client/result.rb', line 63 def house_no fetch_extended_attributes.fetch(:kvh, {}).fetch(:house_no, nil) end |
#ownerships ⇒ Object
List of ownerships
94 95 96 97 98 99 100 101 |
# File 'lib/nne_client/result.rb', line 94 def ownerships ownerships = fetch_ownerships if ownerships.kind_of?(Hash) [Ownership.new(ownerships)] else ownerships.map{|ownership| Ownership.new(ownership) } end end |
#subsidiaries ⇒ Object
List of subsidiaries
104 105 106 107 108 109 110 111 |
# File 'lib/nne_client/result.rb', line 104 def subsidiaries subsidiaries = fetch_subsidiaries if subsidiaries.kind_of?(Hash) [Subsidiary.new(subsidiaries)] else subsidiaries.map{|subsidiary| Subsidiary.new(subsidiary) } end end |