Class: TaxJp::Address
- Inherits:
-
Object
- Object
- TaxJp::Address
- Defined in:
- lib/tax_jp/address.rb
Overview
減価償却率
Constant Summary collapse
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#prefecture_code ⇒ Object
readonly
Returns the value of attribute prefecture_code.
-
#prefecture_name ⇒ Object
readonly
Returns the value of attribute prefecture_name.
-
#section ⇒ Object
readonly
Returns the value of attribute section.
-
#zip_code ⇒ Object
readonly
Returns the value of attribute zip_code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(row) ⇒ Address
constructor
A new instance of Address.
Constructor Details
#initialize(row) ⇒ Address
Returns a new instance of Address.
13 14 15 16 17 18 19 |
# File 'lib/tax_jp/address.rb', line 13 def initialize(row) @zip_code = row[0] @prefecture_code = row[1] @prefecture_name = row[2] @city = row[3] @section = row[4] end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
11 12 13 |
# File 'lib/tax_jp/address.rb', line 11 def city @city end |
#prefecture_code ⇒ Object (readonly)
Returns the value of attribute prefecture_code.
10 11 12 |
# File 'lib/tax_jp/address.rb', line 10 def prefecture_code @prefecture_code end |
#prefecture_name ⇒ Object (readonly)
Returns the value of attribute prefecture_name.
10 11 12 |
# File 'lib/tax_jp/address.rb', line 10 def prefecture_name @prefecture_name end |
#section ⇒ Object (readonly)
Returns the value of attribute section.
11 12 13 |
# File 'lib/tax_jp/address.rb', line 11 def section @section end |
#zip_code ⇒ Object (readonly)
Returns the value of attribute zip_code.
9 10 11 |
# File 'lib/tax_jp/address.rb', line 9 def zip_code @zip_code end |
Class Method Details
.find_by_zip_code(zip_code) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tax_jp/address.rb', line 21 def self.find_by_zip_code(zip_code) zip_code = TaxJp::Utils.convert_to_zip_code(zip_code) TaxJp::Utils.with_database(DB_PATH) do |db| sql = 'select * from addresses ' sql << 'where zip_code = ? ' ret = nil db.execute(sql, [zip_code]) do |row| ret = TaxJp::Address.new(row) end ret end end |