Class: AbnLookup::Abn
- Inherits:
-
Object
- Object
- AbnLookup::Abn
- Defined in:
- lib/abn_lookup/abn.rb
Instance Attribute Summary collapse
-
#abn ⇒ Object
Returns the value of attribute abn.
-
#abn_status ⇒ Object
Returns the value of attribute abn_status.
-
#abn_status_effective_from ⇒ Object
Returns the value of attribute abn_status_effective_from.
-
#acn ⇒ Object
Returns the value of attribute acn.
-
#address_date ⇒ Object
Returns the value of attribute address_date.
-
#address_postcode ⇒ Object
Returns the value of attribute address_postcode.
-
#address_state ⇒ Object
Returns the value of attribute address_state.
-
#business_name ⇒ Object
Returns the value of attribute business_name.
-
#entity_name ⇒ Object
Returns the value of attribute entity_name.
-
#entity_type_code ⇒ Object
Returns the value of attribute entity_type_code.
-
#entity_type_name ⇒ Object
Returns the value of attribute entity_type_name.
-
#gst ⇒ Object
Returns the value of attribute gst.
-
#message ⇒ Object
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#abn ⇒ Object
Returns the value of attribute abn.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def abn @abn end |
#abn_status ⇒ Object
Returns the value of attribute abn_status.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def abn_status @abn_status end |
#abn_status_effective_from ⇒ Object
Returns the value of attribute abn_status_effective_from.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def abn_status_effective_from @abn_status_effective_from end |
#acn ⇒ Object
Returns the value of attribute acn.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def acn @acn end |
#address_date ⇒ Object
Returns the value of attribute address_date.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def address_date @address_date end |
#address_postcode ⇒ Object
Returns the value of attribute address_postcode.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def address_postcode @address_postcode end |
#address_state ⇒ Object
Returns the value of attribute address_state.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def address_state @address_state end |
#business_name ⇒ Object
Returns the value of attribute business_name.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def business_name @business_name end |
#entity_name ⇒ Object
Returns the value of attribute entity_name.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def entity_name @entity_name end |
#entity_type_code ⇒ Object
Returns the value of attribute entity_type_code.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def entity_type_code @entity_type_code end |
#entity_type_name ⇒ Object
Returns the value of attribute entity_type_name.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def entity_type_name @entity_type_name end |
#gst ⇒ Object
Returns the value of attribute gst.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def gst @gst end |
#message ⇒ Object
Returns the value of attribute message.
3 4 5 |
# File 'lib/abn_lookup/abn.rb', line 3 def @message end |
Class Method Details
.parse(data) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/abn_lookup/abn.rb', line 15 def self.parse(data) abn = Abn.new # Transforming PascalCase to snake_case snake_case = data.each_with_object({}) do |(key, value), new_hash| new_key = key.to_s.gsub(/([A-Z])/, '_\1').downcase new_hash[new_key.sub(/^_/, '').to_sym] = value end snake_case.each do |key, value| abn.send("#{key}=", value) if abn.respond_to?("#{key}=") end abn end |
Instance Method Details
#active? ⇒ Boolean
7 8 9 |
# File 'lib/abn_lookup/abn.rb', line 7 def active? abn_status == "Active" end |
#inspect ⇒ Object
11 12 13 |
# File 'lib/abn_lookup/abn.rb', line 11 def inspect "#<#{self.class.name}:0x#{object_id} @abn=\"#{abn}\" @acn=\"#{acn}\" @active=#{active?} @gst=\"#{gst}\" @entity_name=\"#{entity_name}\">" end |