Skip to content

Commit

Permalink
Fixing syntactical issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fluke777 committed Sep 19, 2014
1 parent f5a7c2c commit 7d85985
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/gooddata/extensions/enumerable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ def pmapcat(initial = [], &block)

def pselect(&block)
intermediate = pmap(&block)
self.zip(intermediate).select {|x| x[1]}.map {|x| x.first}
zip(intermediate).select { |x| x[1] }.map { |x| x.first }
end
end
9 changes: 6 additions & 3 deletions lib/gooddata/models/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ def [](id, options = {})
elsif id == :all
uri = "/gdc/account/profile/#{c.user.obj_id}/dataload/processes"
data = c.get(uri)
pids = data['processes']['items'].map { |process_data| process_data['process']['links']['self'].match(/\/gdc\/projects\/(\w*)\//)[1] }.uniq
projects_lookup = pids.pmap { |pid| c.projects(pid) }.reduce({}) {|a, e| a[e.pid] = e; a}
pids = data['processes']['items'].map { |process_data| process_data['process']['links']['self'].match(%r{/gdc/projects/(\w*)/})[1] }.uniq
projects_lookup = pids.pmap { |pid| c.projects(pid) }.reduce({}) do |a, e|
a[e.pid] = e
a
end

data['processes']['items'].map do |process_data|
pid = process_data['process']['links']['self'].match(/\/gdc\/projects\/(\w*)\//)[1]
pid = process_data['process']['links']['self'].match(%r{/gdc/projects/(\w*)/})[1]
c.create(Process, process_data, project: projects_lookup[pid])
end
else
Expand Down
2 changes: 1 addition & 1 deletion lib/gooddata/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def [](id, opts = {})
return id if id.instance_of?(GoodData::Project) || id.respond_to?(:project?) && id.project?

if id == :all
Project.all({client: GoodData.connection}.merge(opts))
Project.all({ client: GoodData.connection }.merge(opts))
else
if id.to_s !~ %r{^(\/gdc\/(projects|md)\/)?[a-zA-Z\d]+$}
fail(ArgumentError, 'wrong type of argument. Should be either project ID or path')
Expand Down
8 changes: 4 additions & 4 deletions lib/gooddata/models/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def delete
#
# @return [Boolean]
def disabled?
state == "DISABLED"
state == 'DISABLED'
end

# Is schedule enabled?
Expand All @@ -164,11 +164,11 @@ def enabled?
!disabled?
end

# enables
# enables
#
# @return [GoodData::Schedule]
def enable
@json['schedule']['state'] = "ENABLED"
@json['schedule']['state'] = 'ENABLED'
@dirty = true
self
end
Expand All @@ -177,7 +177,7 @@ def enable
#
# @return [GoodData::Schedule]
def disable
@json['schedule']['state'] = "DISABLED"
@json['schedule']['state'] = 'DISABLED'
@dirty = true
self
end
Expand Down

0 comments on commit 7d85985

Please sign in to comment.