Class: Kokkai::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/kokkai/record.rb

Direct Known Subclasses

Speech

Constant Summary collapse

DEFAULT_ATTRIBUTES =
%i(session number_of_house name_of_meeting issue date meeting_url pdf_url).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Record

Returns a new instance of Record.



23
24
25
26
# File 'lib/kokkai/record.rb', line 23

def initialize(raw)
  @raw = raw
  @raw_record = @raw.dig("recordData")
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



7
8
9
# File 'lib/kokkai/record.rb', line 7

def raw
  @raw
end

#raw_recordObject (readonly)

Returns the value of attribute raw_record.



7
8
9
# File 'lib/kokkai/record.rb', line 7

def raw_record
  @raw_record
end

Class Method Details

.define_attribute_methods(attrs) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/kokkai/record.rb', line 12

def define_attribute_methods(attrs)
  attrs.each do |attr|
    define_method(attr) do
      @raw_record ? @raw_record[attr.to_s.to_camel] : nil
    end
  end
end