class Kamome::Models::Address

Constants

STATE_DELETE
STATE_NOT_CHANGE
STATE_UPDATE

Attributes

ambiguous_town[RW]

@!attribute [rw] ambiguous_town

一町域が二以上の郵便番号で表される場合 true
genre: :general のみ
@return [Boolean]
city[RW]

@!attribute [rw] city

市区町村
@return [String]
code[RW]

@!attribute [rw] code

全国地方公共団体コード
@return [String]
company_name[RW]

@!attribute [rw] company_name

企業名/団体名 等
@return [String]
post_office_box[RW]

@!attribute [rw] post_office_box

私書箱名
@return [String]
prefecture[RW]

@!attribute [rw] prefecture

都道府県名
@return [String]
state[RW]

@!attribute [rw] state

状態
  0: 変更なし
  1: 変更あり
  2: 削除
@return [Integer]
street[RW]

@!attribute [rw] street

番地, 建物等
@return [String]
town[RW]

@!attribute [rw] town

町域
@return [String]
zipcode[RW]

@!attribute [rw] zipcode

郵便番号(7桁)
@return [String]

Public Class Methods

new(params = {}) click to toggle source

@params [Hash] model attributes

# File lib/kamome/models/address.rb, line 65
def initialize(params = {})
  params.each do |key, value|
    public_send("#{key}=", value)
  end
end

Public Instance Methods

attributes() click to toggle source

@return [Hash] model attributes

# 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?() click to toggle source

Returns true when state is 1 or 2 @return [Boolean]

# File lib/kamome/models/address.rb, line 89
def change?
  updated? || deleted?
end
delete?() click to toggle source

Returns true when state is 2 @return [Boolean]

# File lib/kamome/models/address.rb, line 101
def delete?
  state == STATE_DELETE
end
update?() click to toggle source

Returns true when state is 1 @return [Boolean]

# File lib/kamome/models/address.rb, line 95
def update?
  state == STATE_UPDATE
end