Class: Orias::Registration

Inherits:
Base
  • Object
show all
Defined in:
lib/orias/registration.rb

Overview

Dedicated to Orias registrations objects handling

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Registration

Initialize an Orias::Registration instance



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/orias/registration.rb', line 9

def initialize(attributes = {})
  @raw = attributes

  @category_name = @raw.dig('categoryName')
  @status = @raw.dig('status')
  @subscribed = @status == 'INSCRIT'
  @registration_date = @raw.dig('registrationDate')
  @collect_funds = @raw.dig('collectFunds') == 'true'

  raw_mandators = @raw.dig('mandators', 'mandator')
  unless raw_mandators.is_a?(Array)
    raw_mandators = [raw_mandators]
  end

  @mandators = raw_mandators.compact.map do |h|
    Orias::Mandator.new(h)
  end
end

Instance Attribute Details

#category_nameObject

Returns the value of attribute category_name.



5
6
7
# File 'lib/orias/registration.rb', line 5

def category_name
  @category_name
end

#collect_fundsObject

Returns the value of attribute collect_funds.



5
6
7
# File 'lib/orias/registration.rb', line 5

def collect_funds
  @collect_funds
end

#mandatorsObject

Returns the value of attribute mandators.



5
6
7
# File 'lib/orias/registration.rb', line 5

def mandators
  @mandators
end

#rawObject

Returns the value of attribute raw.



5
6
7
# File 'lib/orias/registration.rb', line 5

def raw
  @raw
end

#registration_dateObject

Returns the value of attribute registration_date.



5
6
7
# File 'lib/orias/registration.rb', line 5

def registration_date
  @registration_date
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/orias/registration.rb', line 5

def status
  @status
end

#subscribedObject

Returns the value of attribute subscribed.



5
6
7
# File 'lib/orias/registration.rb', line 5

def subscribed
  @subscribed
end