class WsCee::Document

Attributes

court[R]
description[R]
executor_company[R]
issue_date[R]
non_monetary[R]
one_time_price[R]
reference_number[R]
regular_price[R]
subjects[R]
type[R]

Public Class Methods

new(document_hash) click to toggle source
# File lib/ws_cee_client/document.rb, line 14
def initialize(document_hash)
  @type = document_hash[:type]
  @description = document_hash[:description]
  @executor_company = document_hash[:executor_company]
  @court = document_hash[:court]
  @reference_number = document_hash[:reference_number]
  @issue_date = document_hash[:issue_date]
  @one_time_price = document_hash[:one_time_price]
  @regular_price = document_hash[:regular_price]
  @non_monetary = document_hash[:non_monetary]

  @subjects = []
  parse_subject document_hash[:subject]
rescue NoMethodError
  raise WsCee::ParsingError
end

Private Instance Methods

parse_subject(subject_hash) click to toggle source
# File lib/ws_cee_client/document.rb, line 33
def parse_subject(subject_hash)
  if subject_hash.is_a? Array
    @subjects = subject_hash.collect { |subject| Subject.new subject }
  else
    @subjects << Subject.new(subject_hash)
  end
end