lms-api 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f134bb198925066aafd244adbe8b9458d38a902d
4
- data.tar.gz: 918c848dd6f101ed790ad89f639d86898544957b
3
+ metadata.gz: f182102f509fff4feecee592af532d5fc17a0c85
4
+ data.tar.gz: 5b25c94988f5370f683db18377af63a0f88b2a7b
5
5
  SHA512:
6
- metadata.gz: c83f5a8f9ce82dced14cd51bfe9e2d114fb25f32654ef4ce97b7ad027558fa90be54f634ed5fb2205bf1f5cc90998da1cbdd7ba00660a55f8aa65a9231aef6a0
7
- data.tar.gz: c5dbb430ce2cdb6ab58b09ce37a36eb226f8c421b2c34f3a38e1f24b25db22c7e63848f07b354d177d13141254e6f77204485fa93f91b8c75427e9a566aefd24
6
+ metadata.gz: 8a8ae05c32f16f16c68861a59aed40af9c2c304a9df67ce18c8c48c4f5a5c79b04ea6df95c0f02d4cf48164b25152037d9944bb5a20b46d683534cf2c34fb63b
7
+ data.tar.gz: 5fffdc14c8e1def75fcba8f156af5d4502a3f7cecbbc2c563dd76bb1432bcd61cdc27f41d757d2f77f5c08db469bb0932a94caef080458708a1d01683032475d
@@ -9,12 +9,13 @@ module CanvasApi
9
9
  # client_app_path: This where all client side Javascript for accessing the Canvas API will be written.
10
10
  # server_app_path: This is where all server side Javascript for accessing the Canvas API will be written. Currently, this is generating GraphQL for Javascript
11
11
  #
12
- def self.build(project_root, client_app_path, server_app_path)
12
+ def self.build(project_root, client_app_path, server_app_path, elixir_app_path)
13
13
  endpoint = "https://canvas.instructure.com/doc/api"
14
14
  directory = HTTParty.get("#{endpoint}/api-docs.json")
15
15
 
16
16
  lms_urls_rb = []
17
17
  lms_urls_js = []
18
+ lms_urls_ex = []
18
19
  models = []
19
20
  queries = []
20
21
  mutations = []
@@ -28,6 +29,7 @@ module CanvasApi
28
29
  constants << CanvasApi::Render.new("./templates/constant.erb", api, resource, resource_api, operation, parameters, nil, nil).render
29
30
  lms_urls_rb << CanvasApi::Render.new("./templates/rb_url.erb", api, resource, resource_api, operation, parameters, nil, nil).render
30
31
  lms_urls_js << CanvasApi::Render.new("./templates/js_url.erb", api, resource, resource_api, operation, parameters, nil, nil).render
32
+ lms_urls_ex << CanvasApi::Render.new("./templates/ex_url.erb", api, resource, resource_api, operation, parameters, nil, nil).render
31
33
  if "GET" == operation["method"].upcase
32
34
  queries << CanvasApi::Render.new("./templates/graphql_query.erb", api, resource, resource_api, operation, parameters, nil, nil).render
33
35
  else
@@ -47,6 +49,7 @@ module CanvasApi
47
49
 
48
50
  CanvasApi::Render.new("./templates/rb_urls.erb", nil, nil, nil, nil, nil, lms_urls_rb, nil).save("#{project_root}/lib/lms/canvas_urls.rb")
49
51
  CanvasApi::Render.new("./templates/js_urls.erb", nil, nil, nil, nil, nil, lms_urls_js, nil).save("#{server_app_path}/lib/canvas/urls.js")
52
+ CanvasApi::Render.new("./templates/ex_urls.erb", nil, nil, nil, nil, nil, lms_urls_ex, nil).save("#{elixir_app_path}/lib/canvas/actions.ex")
50
53
 
51
54
  # GraphQL - still not complete
52
55
  CanvasApi::Render.new("./templates/graphql_types.erb", nil, nil, nil, nil, nil, models.compact, nil).save("#{server_app_path}/lib/canvas/graphql_types.js")
@@ -56,4 +59,4 @@ module CanvasApi
56
59
 
57
60
  end
58
61
 
59
- end
62
+ end
@@ -0,0 +1,18 @@
1
+ def action("<%=@nickname.upcase%>"), do: %{ uri: fn(<%= @args.present? ? "%{" : "" %><%=@args.map{|a| "\"#{a}\" => #{a}"}.join(', ')%><%= @args.present? ? "}" : "" %>) -> "<%=ruby_api_url(@api_url)%>" end, method: :<%=@method%>, parameters: [<%= @parameters.map do |p|
2
+ str = []
3
+ p.each do |property, value|
4
+ fixed_val = if value.is_a?(Hash)
5
+ "%#{value}"
6
+ elsif value.is_a?(String)
7
+ "\"#{value}\""
8
+ elsif value.nil?
9
+ "nil"
10
+ else
11
+ value
12
+ end
13
+
14
+ str << "\"#{property}\" => #{fixed_val}"
15
+ end
16
+ "%{ #{str.join(", ")} }"
17
+ end.join(", ")
18
+ %>] }
@@ -0,0 +1,4 @@
1
+ defmodule Canvas.Actions do
2
+ <%=@content.join("\n ")%>
3
+ def action(type), do: raise InvalidCanvasActionException, message: "Invalid Canvas API Action: #{type}}"
4
+ end
@@ -1,3 +1,3 @@
1
1
  module LMS
2
- VERSION = "1.3.1".freeze
2
+ VERSION = "1.3.2".freeze
3
3
  end
@@ -15,7 +15,8 @@ namespace :canvas do
15
15
  current_path = File.expand_path(File.dirname(__FILE__))
16
16
  client_app_path = File.expand_path(File.join(current_path, "../../../atomic-client/client/libs/canvas/constants"))
17
17
  server_app_path = File.expand_path(File.join(current_path, "../../../atomic-lti"))
18
+ elixir_app_path = File.expand_path(File.join(current_path, "../../../atomic-search"))
18
19
  project_root = File.expand_path(File.join(current_path, "../../"))
19
- CanvasApi::Builder.build(project_root, client_app_path, server_app_path)
20
+ CanvasApi::Builder.build(project_root, client_app_path, server_app_path, elixir_app_path)
20
21
  end
21
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lms-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Atomic Jolt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-04-14 00:00:00.000000000 Z
13
+ date: 2017-05-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -115,6 +115,8 @@ files:
115
115
  - lib/canvas_api/ruby_helpers.rb
116
116
  - lib/canvas_api/templates/constant.erb
117
117
  - lib/canvas_api/templates/constants.erb
118
+ - lib/canvas_api/templates/ex_url.erb
119
+ - lib/canvas_api/templates/ex_urls.erb
118
120
  - lib/canvas_api/templates/graphql_model.erb
119
121
  - lib/canvas_api/templates/graphql_mutation.erb
120
122
  - lib/canvas_api/templates/graphql_mutations.erb