Class: Asdawqw::CompanyDetails

Inherits:
BaseModel show all
Defined in:
lib/asdawqw/models/company_details.rb

Overview

CompanyDetails Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_id = nil, company_name = nil, language = nil, full_name = nil, company_address = nil, website = nil, email = nil, phone = nil, currency = nil, password = nil) ⇒ CompanyDetails

Returns a new instance of CompanyDetails.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/asdawqw/models/company_details.rb', line 70

def initialize( = nil,
               company_name = nil,
               language = nil,
               full_name = nil,
               company_address = nil,
               website = nil,
               email = nil,
               phone = nil,
               currency = nil,
               password = nil)
  @account_id = 
  @company_name = company_name
  @language = language
  @full_name = full_name
  @company_address = company_address
  @website = website
  @email = email
  @phone = phone
  @password = password
  @currency = currency
end

Instance Attribute Details

#account_idString

Unique ID of PM in PMS

Returns:



11
12
13
# File 'lib/asdawqw/models/company_details.rb', line 11

def 
  @account_id
end

#company_addressCompanyAddress

Model

Returns:



27
28
29
# File 'lib/asdawqw/models/company_details.rb', line 27

def company_address
  @company_address
end

#company_nameString

Name of PM

Returns:



15
16
17
# File 'lib/asdawqw/models/company_details.rb', line 15

def company_name
  @company_name
end

#currencyString

PM default currency. ISO 4217 code is required

Returns:



52
53
54
# File 'lib/asdawqw/models/company_details.rb', line 52

def currency
  @currency
end

#emailString

Email of PM. Email need to be unique in BP system, so you might receive error if we already have this email in our system

Returns:



36
37
38
# File 'lib/asdawqw/models/company_details.rb', line 36

def email
  @email
end

#full_nameString

First and Last Name

Returns:



23
24
25
# File 'lib/asdawqw/models/company_details.rb', line 23

def full_name
  @full_name
end

#languageString

Language 2 letter value as ISO 639-1 code

Returns:



19
20
21
# File 'lib/asdawqw/models/company_details.rb', line 19

def language
  @language
end

#passwordString

Password for accessing PM. If the password is not passed in the request random password will be generated and returned in response. Password will be in response only on create and if it is manually generated. Special characters are not allowed, instead use UTF-8 codes, for example instead of # use %23

Returns:



48
49
50
# File 'lib/asdawqw/models/company_details.rb', line 48

def password
  @password
end

#phonePhone

Model

Returns:



40
41
42
# File 'lib/asdawqw/models/company_details.rb', line 40

def phone
  @phone
end

#websiteString

Company (PM) website URL

Returns:



31
32
33
# File 'lib/asdawqw/models/company_details.rb', line 31

def website
  @website
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/asdawqw/models/company_details.rb', line 93

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash['accountId']
  company_name = hash['companyName']
  language = hash['language']
  full_name = hash['fullName']
  company_address = CompanyAddress.from_hash(hash['companyAddress']) if
    hash['companyAddress']
  website = hash['website']
  email = hash['email']
  phone = Phone.from_hash(hash['phone']) if hash['phone']
  currency = hash['currency']
  password = hash['password']

  # Create object from extracted values.
  CompanyDetails.new(,
                     company_name,
                     language,
                     full_name,
                     company_address,
                     website,
                     email,
                     phone,
                     currency,
                     password)
end

.namesObject

A mapping from model property names to API property names.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/asdawqw/models/company_details.rb', line 55

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'accountId'
  @_hash['company_name'] = 'companyName'
  @_hash['language'] = 'language'
  @_hash['full_name'] = 'fullName'
  @_hash['company_address'] = 'companyAddress'
  @_hash['website'] = 'website'
  @_hash['email'] = 'email'
  @_hash['phone'] = 'phone'
  @_hash['password'] = 'password'
  @_hash['currency'] = 'currency'
  @_hash
end