Skip to content

Commit

Permalink
Fixed issues related to searching statements
Browse files Browse the repository at this point in the history
  • Loading branch information
kibenimatik committed Aug 8, 2016
1 parent f4d38e3 commit c97a24f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/tin_can_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
require 'tin_can_api/statement'
require 'tin_can_api/sub_statement'
require 'tin_can_api/statement_ref'
require 'tin_can_api/statements_result'
require 'tin_can_api/statements_query'
require 'tin_can_api/statements_query_v095'
require 'tin_can_api/lrs_response'
Expand Down
6 changes: 3 additions & 3 deletions lib/tin_can_api/remote_lrs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def query_statements(statement_query)
if response.status == 200
# TODO: FIX THIS
lrs.success = true
lrs.content = StatementsResult.new(json: response.body)
lrs.content = StatementsResult.new(json: JSON.parse(response.body))
else
lrs.success = false
end
Expand All @@ -132,7 +132,7 @@ def more_statements(more_url)
if response.status == 200
# TODO: FIX THIS
lrs.success = true
lrs.content = StatementsResult.new(json: response.body)
lrs.content = StatementsResult.new(json: JSON.parse(response.body))
else
lrs.success = false
end
Expand Down Expand Up @@ -400,4 +400,4 @@ def get_profile_keys(resource, params)
end

end
end
end
6 changes: 3 additions & 3 deletions lib/tin_can_api/statements_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class StatementsQuery
attr_accessor :stored_since, :stored_until, :limit, :format, :ascending

def initialize(&block)
self.version = TCAPIVersion::V101
@version = TCAPIVersion::V101
if block_given?
block[self]
end
Expand All @@ -23,7 +23,7 @@ def verb_id=(value)

def parameter_map
params = {}
params['agent'] = agent.serialize(version) if agent
params['agent'] = agent.serialize(version).to_json if agent
params['verb'] = verb_id.to_s if verb_id
params['activity'] = activity_id.to_s if activity_id
params['registration'] = registration if registration
Expand All @@ -39,4 +39,4 @@ def parameter_map
end

end
end
end
4 changes: 2 additions & 2 deletions lib/tin_can_api/statements_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def initialize(options={})
json = options.fetch(:json, nil)
self.statements = []
if json
self.statements = json['statements'].map {|statement| Statement.new(json: statement)} if json['statements']
self.statements = json['statements'].map {|statement| Statement.new(json: statement.to_json)} if json['statements']
self.more_url = json['more'] if json['more']
end
end
end
end
end

0 comments on commit c97a24f

Please sign in to comment.