Skip to content

Commit

Permalink
Fixes converting events xml (#2)
Browse files Browse the repository at this point in the history
* Accept newer versions of bundle

* Fix conversion of nested models to json

Was converting them into json twice, so they would appear as a string
in the final result.

* Fix parsing when there's only one event in events.xml

* Add :to_h to recording
  • Loading branch information
daronco authored and jfederico committed Jul 10, 2019
1 parent fc5fed6 commit d0a8a45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bbbevents.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.15"
spec.add_development_dependency "bundler", ">= 1.15"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.4"

Expand Down
15 changes: 10 additions & 5 deletions lib/bbbevents/recording.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def initialize(events_xml)
raise "#{filename} is missing recording key." unless raw_recording_data.key?("recording")

recording_data = raw_recording_data["recording"]
events = recording_data["event"]
events = recording_data["event"]
events = [events] unless events.is_a?(Array)

@metadata = recording_data["metadata"]
@meeting_id = recording_data["meeting"]["id"]
Expand Down Expand Up @@ -90,17 +91,21 @@ def create_csv(filepath)
end
end

def to_json
def to_h
{
metadata: @metadata,
meeting_id: @meeting_id,
duration: @duration,
start: @start,
finish: @finish,
attendees: attendees.map(&:to_h),
attendees: attendees.map(&:to_h),
files: @files,
polls: polls.map(&:to_h),
}.to_json
polls: polls.map(&:to_h)
}
end

def to_json
to_h.to_json
end

private
Expand Down

0 comments on commit d0a8a45

Please sign in to comment.