Class: Clearbooks::Entity
Overview
Instance Attribute Summary collapse
-
#address1 ⇒ String
readonly
Optional.
-
#address2 ⇒ String
readonly
Optional.
-
#building ⇒ String
readonly
Optional.
-
#company_name ⇒ String
readonly
Optional.
-
#company_number ⇒ Fixnum
readonly
Optional.
-
#contact_name ⇒ String
readonly
Optional.
-
#country ⇒ String
readonly
Optional.
-
#county ⇒ String
readonly
Optional.
-
#customer ⇒ Hash
readonly
Optional.
-
#email ⇒ String
readonly
Optional.
-
#external_id ⇒ Fixnum
readonly
Optional.
-
#fax ⇒ String
readonly
Optional.
-
#id ⇒ Fixnum
readonly
Entity Id.
-
#phone1 ⇒ String
readonly
Optional.
-
#phone2 ⇒ String
readonly
Optional.
-
#postcode ⇒ String
readonly
Optional.
-
#statement_url ⇒ String
readonly
The URL the customer/supplier can access to view statements.
-
#supplier ⇒ Hash
readonly
Optional.
-
#town ⇒ String
readonly
Optional.
-
#vat_number ⇒ Fixnum
readonly
Optional.
-
#website ⇒ String
readonly
Optional.
Instance Method Summary collapse
-
#initialize(data) ⇒ Entity
constructor
A new instance of Entity.
-
#to_savon ⇒ Hash
Returns self as Savon readable Hash.
Methods inherited from Base
Constructor Details
#initialize(data) ⇒ Entity
Returns a new instance of Entity.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/clearbooks/model/entity.rb', line 151 def initialize data @id = Integer data.savon(:id) rescue nil @company_name = data.savon :company_name @contact_name = data.savon :contact_name @building = data.savon :building @address1 = data.savon :address1 @address2 = data.savon :address2 @town = data.savon :town @county = data.savon :county @country = data.savon :country @postcode = data.savon :postcode @email = data.savon :email @phone1 = data.savon :phone1 @phone2 = data.savon :phone2 @fax = data.savon :fax @website = data.savon :website @company_number = data.savon :company_number @vat_number = data.savon :vat_number @statement_url = data.savon :statement_url @external_id = data.savon :external_id @supplier = entity_extra data.savon :supplier @supplier = @supplier.from_savon if @supplier @customer = entity_extra data.savon :customer @customer = @customer.from_savon if @customer end |
Instance Attribute Details
#address1 ⇒ String (readonly)
Optional.
65 66 67 |
# File 'lib/clearbooks/model/entity.rb', line 65 def address1 @address1 end |
#address2 ⇒ String (readonly)
Optional.
70 71 72 |
# File 'lib/clearbooks/model/entity.rb', line 70 def address2 @address2 end |
#building ⇒ String (readonly)
Optional.
60 61 62 |
# File 'lib/clearbooks/model/entity.rb', line 60 def building @building end |
#company_name ⇒ String (readonly)
Optional.
50 51 52 |
# File 'lib/clearbooks/model/entity.rb', line 50 def company_name @company_name end |
#company_number ⇒ Fixnum (readonly)
Optional.
130 131 132 |
# File 'lib/clearbooks/model/entity.rb', line 130 def company_number @company_number end |
#contact_name ⇒ String (readonly)
Optional.
55 56 57 |
# File 'lib/clearbooks/model/entity.rb', line 55 def contact_name @contact_name end |
#country ⇒ String (readonly)
Optional. Country code.
85 86 87 |
# File 'lib/clearbooks/model/entity.rb', line 85 def country @country end |
#county ⇒ String (readonly)
Optional.
80 81 82 |
# File 'lib/clearbooks/model/entity.rb', line 80 def county @county end |
#customer ⇒ Hash (readonly)
Optional. [:default_account_code, :default_vat_rate, :default_credit_terms]
140 141 142 |
# File 'lib/clearbooks/model/entity.rb', line 140 def customer @customer end |
#email ⇒ String (readonly)
Optional.
95 96 97 |
# File 'lib/clearbooks/model/entity.rb', line 95 def email @email end |
#external_id ⇒ Fixnum (readonly)
Optional.
120 121 122 |
# File 'lib/clearbooks/model/entity.rb', line 120 def external_id @external_id end |
#fax ⇒ String (readonly)
Optional.
110 111 112 |
# File 'lib/clearbooks/model/entity.rb', line 110 def fax @fax end |
#id ⇒ Fixnum (readonly)
Returns Entity Id.
42 43 44 |
# File 'lib/clearbooks/model/entity.rb', line 42 def id @id end |
#phone1 ⇒ String (readonly)
Optional.
100 101 102 |
# File 'lib/clearbooks/model/entity.rb', line 100 def phone1 @phone1 end |
#phone2 ⇒ String (readonly)
Optional.
105 106 107 |
# File 'lib/clearbooks/model/entity.rb', line 105 def phone2 @phone2 end |
#postcode ⇒ String (readonly)
Optional.
90 91 92 |
# File 'lib/clearbooks/model/entity.rb', line 90 def postcode @postcode end |
#statement_url ⇒ String (readonly)
Returns The URL the customer/supplier can access to view statements.
46 47 48 |
# File 'lib/clearbooks/model/entity.rb', line 46 def statement_url @statement_url end |
#supplier ⇒ Hash (readonly)
Optional. [:default_account_code, :default_vat_rate, :default_credit_terms]
135 136 137 |
# File 'lib/clearbooks/model/entity.rb', line 135 def supplier @supplier end |
#town ⇒ String (readonly)
Optional.
75 76 77 |
# File 'lib/clearbooks/model/entity.rb', line 75 def town @town end |
#vat_number ⇒ Fixnum (readonly)
Optional.
125 126 127 |
# File 'lib/clearbooks/model/entity.rb', line 125 def vat_number @vat_number end |
#website ⇒ String (readonly)
Optional.
115 116 117 |
# File 'lib/clearbooks/model/entity.rb', line 115 def website @website end |
Instance Method Details
#to_savon ⇒ Hash
Returns self as Savon readable Hash
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/clearbooks/model/entity.rb', line 187 def to_savon { entity: { :@company_name => @company_name, :@contact_name => @contact_name, :@building => @building, :@address1 => @address1, :@address2 => @address2, :@town => @town, :@county => @county, :@country => @country, :@postcode => @postcode, :@email => @email, :@phone1 => @phone1, :@phone2 => @phone2, :@fax => @fax, :@website => @website, :@company_number => @company_number, :@vat_number => @vat_number, :@external_id => @external_id, :supplier => entity_extra(@supplier), :customer => entity_extra(@customer) }.compact } end |