Class: CompaniesHouse::Response
- Inherits:
-
Object
- Object
- CompaniesHouse::Response
- Defined in:
- lib/companies_house/response.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#[](key) ⇒ Object
So that you can call attributes on the companies house object: company.
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
-
#sic_code ⇒ Object
Return a SIC code from the ugly hash.
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
7 8 9 10 |
# File 'lib/companies_house/response.rb', line 7 def initialize(response) check_for_errors(response) parse_response(response) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/companies_house/response.rb', line 5 def attributes @attributes end |
Instance Method Details
#[](key) ⇒ Object
So that you can call attributes on the companies house object: company
25 26 27 |
# File 'lib/companies_house/response.rb', line 25 def [](key) @attributes[key] end |
#sic_code ⇒ Object
Return a SIC code from the ugly hash
company.sic_code
> “62090”
17 18 19 20 21 |
# File 'lib/companies_house/response.rb', line 17 def sic_code if self["SICCodes"] && self["SICCodes"]["SicText"] self["SICCodes"]["SicText"].first.split[0] end end |