Class: Recras::Person

Inherits:
Object
  • Object
show all
Extended by:
Recras
Defined in:
lib/recras/person.rb

Constant Summary

Constants included from Recras

API_VERSION, VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Recras

make_request, new_from_json, object_mappings, parse_json, url, version

Constructor Details

#initialize(args = nil) ⇒ Person

Initializer to transform a Hash into an Client object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/recras/person.rb', line 27

def initialize(args=nil)
  required_args = []
  for arg in required_args
    if args.nil? || args[arg].nil?
      raise RecrasError.new(self), "Insufficient login credentials. Please provide @username, @password"
    end
  end

  return if args.nil?
  args.each do |k,v|
    instance_variable_set("@#{k}", v) unless v.nil?
  end
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



9
10
11
# File 'lib/recras/person.rb', line 9

def address
  @address
end

#bank_account_numberObject

Returns the value of attribute bank_account_number.



16
17
18
# File 'lib/recras/person.rb', line 16

def 
  @bank_account_number
end

#cityObject

Returns the value of attribute city.



11
12
13
# File 'lib/recras/person.rb', line 11

def city
  @city
end

#company_idObject

Returns the value of attribute company_id.



15
16
17
# File 'lib/recras/person.rb', line 15

def company_id
  @company_id
end

#country_codeObject

Returns the value of attribute country_code.



12
13
14
# File 'lib/recras/person.rb', line 12

def country_code
  @country_code
end

#emailObject

Returns the value of attribute email.



20
21
22
# File 'lib/recras/person.rb', line 20

def email
  @email
end

#first_nameObject

Note:

The is a required parameter.



6
7
8
# File 'lib/recras/person.rb', line 6

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/recras/person.rb', line 7

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



18
19
20
# File 'lib/recras/person.rb', line 18

def last_name
  @last_name
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/recras/person.rb', line 8

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



19
20
21
# File 'lib/recras/person.rb', line 19

def phone
  @phone
end

#postal_codeObject

Returns the value of attribute postal_code.



10
11
12
# File 'lib/recras/person.rb', line 10

def postal_code
  @postal_code
end

#region_codeObject

Returns the value of attribute region_code.



13
14
15
# File 'lib/recras/person.rb', line 13

def region_code
  @region_code
end

#vat_numberObject

Returns the value of attribute vat_number.



14
15
16
# File 'lib/recras/person.rb', line 14

def vat_number
  @vat_number
end

Class Method Details

.attribute_mappingObject

translates the mapping between the Recras API and the terms used in this gem



43
44
45
# File 'lib/recras/person.rb', line 43

def self.attribute_mapping
  [["id", "id"],["displaynaam", "name"],["adres", "address"],["postcode", "postal_code"], ["plaats", "city"], ["landcode", "country_code"],["bedrijf_id", "company_id"],["telefoon1","phone"],["email1", "email"]]
end