Module: PandaPal::OrganizationConcerns::OrganizationBuilder
Defined Under Namespace
Classes: InteractiveSessionError
Instance Method Summary
collapse
#settings_structure, #validate_settings
Instance Method Details
#generate_orgbuilder_ruby ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'app/models/panda_pal/organization_concerns/organization_builder.rb', line 127
def generate_orgbuilder_ruby
code = ConsoleHelpers::CodeBuilder.new
columns = %w[
canvas_account_id
key
secret
salesforce_id
]
if self.persisted?
code << "PandaPal::Organization.find_by(name: \"#{self.name}\").update!("
else
code << "PandaPal::Organization.create!("
columns.unshift("name")
end
code << "\n"
code.block do
columns.each do |col|
code << "#{col}: \"#{self.send(col)}\","
code << "\n"
end
code << "settings: "
code << PandaPal::Organization.generate_settings_ruby(value: settings)
code << ",\n"
end
code << ")"
code.to_s
end
|
#interactive_install!(host: nil, exists: :error) ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'app/models/panda_pal/organization_concerns/organization_builder.rb', line 105
def interactive_install!(host: nil, exists: :error)
first = true
loop do
unless first && host.present?
if Rails.env.development?
host ||= ConsoleHelpers.pandapalrc["lti_host"].presence || "http://localhost:5000"
end
host = ConsoleHelpers.prompt("Specify LTI host:", default: host)
end
begin
install_lti(host: host, exists: exists)
break
rescue => ex
puts "Failed to install in Canvas: #{ex}"
raise ex unless ConsoleHelpers.prompt_pry_retry
first = false
end
end
end
|
#interactive_update! ⇒ Object
99
100
101
102
103
|
# File 'app/models/panda_pal/organization_concerns/organization_builder.rb', line 99
def interactive_update!
saved = self.class._interactive_save!(self)
puts "Organization Updated" if saved
saved
end
|