Class: Kamome::Models::Address
- Inherits:
-
Object
- Object
- Kamome::Models::Address
- Defined in:
- lib/kamome/models/address.rb
Constant Summary collapse
- STATE_NOT_CHANGE =
0
- STATE_UPDATE =
1
- STATE_DELETE =
2
Instance Attribute Summary collapse
-
#ambiguous_town ⇒ Boolean
一町域が二以上の郵便番号で表される場合 true genre: :general のみ.
-
#city ⇒ String
市区町村.
-
#code ⇒ String
全国地方公共団体コード.
-
#company_name ⇒ String
企業名/団体名 等.
-
#post_office_box ⇒ String
私書箱名.
-
#prefecture ⇒ String
都道府県名.
-
#state ⇒ Integer
状態 0: 変更なし 1: 変更あり 2: 削除.
-
#street ⇒ String
番地, 建物等.
-
#town ⇒ String
町域.
-
#zipcode ⇒ String
郵便番号(7桁).
Instance Method Summary collapse
-
#attributes ⇒ Hash
Model attributes.
-
#change? ⇒ Boolean
Returns true when state is 1 or 2.
-
#delete? ⇒ Boolean
Returns true when state is 2.
-
#initialize(params = {}) ⇒ Address
constructor
A new instance of Address.
-
#update? ⇒ Boolean
Returns true when state is 1.
Constructor Details
#initialize(params = {}) ⇒ Address
Returns a new instance of Address.
65 66 67 68 69 |
# File 'lib/kamome/models/address.rb', line 65 def initialize(params = {}) params.each do |key, value| public_send("#{key}=", value) end end |
Instance Attribute Details
#ambiguous_town ⇒ Boolean
一町域が二以上の郵便番号で表される場合 true genre: :general のみ
58 59 60 |
# File 'lib/kamome/models/address.rb', line 58 def ambiguous_town @ambiguous_town end |
#city ⇒ String
市区町村
24 25 26 |
# File 'lib/kamome/models/address.rb', line 24 def city @city end |
#code ⇒ String
全国地方公共団体コード
9 10 11 |
# File 'lib/kamome/models/address.rb', line 9 def code @code end |
#company_name ⇒ String
企業名/団体名 等
39 40 41 |
# File 'lib/kamome/models/address.rb', line 39 def company_name @company_name end |
#post_office_box ⇒ String
私書箱名
44 45 46 |
# File 'lib/kamome/models/address.rb', line 44 def post_office_box @post_office_box end |
#prefecture ⇒ String
都道府県名
19 20 21 |
# File 'lib/kamome/models/address.rb', line 19 def prefecture @prefecture end |
#state ⇒ Integer
状態
0: 変更なし
1: 変更あり
2: 削除
52 53 54 |
# File 'lib/kamome/models/address.rb', line 52 def state @state end |
#street ⇒ String
番地, 建物等
34 35 36 |
# File 'lib/kamome/models/address.rb', line 34 def street @street end |
#town ⇒ String
町域
29 30 31 |
# File 'lib/kamome/models/address.rb', line 29 def town @town end |
#zipcode ⇒ String
郵便番号(7桁)
14 15 16 |
# File 'lib/kamome/models/address.rb', line 14 def zipcode @zipcode end |
Instance Method Details
#attributes ⇒ Hash
Returns model attributes.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/kamome/models/address.rb', line 72 def attributes { code: code, zipcode: zipcode, prefecture: prefecture, city: city, town: town, street: street, company_name: company_name, post_office_box: post_office_box, state: state, ambiguous_town: ambiguous_town } end |
#change? ⇒ Boolean
Returns true when state is 1 or 2
89 90 91 |
# File 'lib/kamome/models/address.rb', line 89 def change? updated? || deleted? end |
#delete? ⇒ Boolean
Returns true when state is 2
101 102 103 |
# File 'lib/kamome/models/address.rb', line 101 def delete? state == STATE_DELETE end |
#update? ⇒ Boolean
Returns true when state is 1
95 96 97 |
# File 'lib/kamome/models/address.rb', line 95 def update? state == STATE_UPDATE end |