docomo-nlu 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +48 -0
  3. data/.reek.yml +98 -0
  4. data/.rubocop.rspec.yml +62 -0
  5. data/.rubocop.ruby.yml +423 -0
  6. data/.rubocop.yml +18 -16
  7. data/.ruby-version +1 -1
  8. data/Gemfile.lock +88 -86
  9. data/docomo-nlu.gemspec +5 -4
  10. data/lib/docomo-nlu.rb +4 -4
  11. data/lib/{docomo-nlu → docomo_nlu}/config.rb +3 -3
  12. data/lib/docomo_nlu/management.rb +31 -0
  13. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/account.rb +1 -1
  14. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/aiml_base.rb +5 -4
  15. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/base.rb +1 -1
  16. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/bot.rb +1 -1
  17. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/bot_log.rb +3 -2
  18. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/config.rb +1 -1
  19. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/default_predicate.rb +1 -1
  20. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/entry.rb +1 -1
  21. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/log.rb +1 -1
  22. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/map.rb +1 -1
  23. data/lib/docomo_nlu/management/multipart_base.rb +85 -0
  24. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/ng_word.rb +1 -1
  25. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/ok_word.rb +1 -1
  26. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/organization.rb +1 -1
  27. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/organization_member.rb +1 -1
  28. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/predicate_name.rb +1 -1
  29. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/project.rb +1 -1
  30. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/project_member.rb +1 -1
  31. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/property.rb +1 -1
  32. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/provider.rb +1 -1
  33. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/scenario.rb +1 -1
  34. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/scenario_project.rb +1 -1
  35. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/scenario_util.rb +1 -1
  36. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/set.rb +1 -1
  37. data/lib/{docomo-nlu/management/V26 → docomo_nlu/management}/task_project.rb +1 -1
  38. data/lib/{docomo-nlu → docomo_nlu}/spontaneous.rb +5 -5
  39. data/lib/{docomo-nlu → docomo_nlu}/version.rb +1 -1
  40. data/vcr/vcr_cassettes/{V26 → management}/account/count.yml +0 -0
  41. data/vcr/vcr_cassettes/{V26 → management}/account/create.yml +0 -0
  42. data/vcr/vcr_cassettes/{V26 → management}/account/delete.yml +0 -0
  43. data/vcr/vcr_cassettes/{V26 → management}/account/index.yml +0 -0
  44. data/vcr/vcr_cassettes/{V26 → management}/account/show.yml +0 -0
  45. data/vcr/vcr_cassettes/{V26 → management}/account/update.yml +0 -0
  46. data/vcr/vcr_cassettes/{V26 → management}/base/login.yml +0 -0
  47. data/vcr/vcr_cassettes/{V26 → management}/base/login_400.yml +0 -0
  48. data/vcr/vcr_cassettes/{V26 → management}/base/logout.yml +0 -0
  49. data/vcr/vcr_cassettes/{V26 → management}/base/logout_400.yml +0 -0
  50. data/vcr/vcr_cassettes/{V26 → management}/bot/create.yml +0 -0
  51. data/vcr/vcr_cassettes/{V26 → management}/bot/create_conflict.yml +0 -0
  52. data/vcr/vcr_cassettes/{V26 → management}/bot/delete.yml +0 -0
  53. data/vcr/vcr_cassettes/{V26 → management}/bot/deploy.yml +0 -0
  54. data/vcr/vcr_cassettes/{V26 → management}/bot/download_aiml.yml +0 -0
  55. data/vcr/vcr_cassettes/{V26 → management}/bot/download_archive.yml +0 -0
  56. data/vcr/vcr_cassettes/{V26 → management}/bot/download_dat.yml +0 -0
  57. data/vcr/vcr_cassettes/{V26 → management}/bot/index.yml +0 -0
  58. data/vcr/vcr_cassettes/{V26 → management}/bot/index_not_found.yml +0 -0
  59. data/vcr/vcr_cassettes/{V26 → management}/bot/show.yml +0 -0
  60. data/vcr/vcr_cassettes/{V26 → management}/bot/upload_aiml.yml +0 -0
  61. data/vcr/vcr_cassettes/{V26 → management}/bot/upload_archive.yml +0 -0
  62. data/vcr/vcr_cassettes/{V26 → management}/bot/upload_dat.yml +0 -0
  63. data/vcr/vcr_cassettes/{V26 → management}/bot_log/all.yml +0 -0
  64. data/vcr/vcr_cassettes/{V26 → management}/bot_log/query.yml +0 -0
  65. data/vcr/vcr_cassettes/{V26 → management}/config/delete.yml +0 -0
  66. data/vcr/vcr_cassettes/{V26 → management}/config/index.yml +0 -0
  67. data/vcr/vcr_cassettes/{V26 → management}/config/show.yml +0 -0
  68. data/vcr/vcr_cassettes/{V26 → management}/config/update.yml +0 -0
  69. data/vcr/vcr_cassettes/{V26 → management}/default_predicate/create.yml +0 -0
  70. data/vcr/vcr_cassettes/{V26 → management}/default_predicate/delete.yml +0 -0
  71. data/vcr/vcr_cassettes/{V26 → management}/default_predicate/index.yml +0 -0
  72. data/vcr/vcr_cassettes/{V26 → management}/default_predicate/index_not_found.yml +0 -0
  73. data/vcr/vcr_cassettes/{V26 → management}/default_predicate/update.yml +0 -0
  74. data/vcr/vcr_cassettes/{V26 → management}/entry/delete.yml +0 -0
  75. data/vcr/vcr_cassettes/{V26 → management}/entry/save.yml +0 -0
  76. data/vcr/vcr_cassettes/{V26 → management}/log/all.yml +0 -0
  77. data/vcr/vcr_cassettes/{V26 → management}/log/count.yml +0 -0
  78. data/vcr/vcr_cassettes/{V26 → management}/log/count/all.yml +0 -0
  79. data/vcr/vcr_cassettes/{V26 → management}/log/count/query.yml +0 -0
  80. data/vcr/vcr_cassettes/{V26 → management}/log/query.yml +0 -0
  81. data/vcr/vcr_cassettes/{V26 → management}/map/create.yml +6 -6
  82. data/vcr/vcr_cassettes/{V26 → management}/map/create_400.yml +0 -0
  83. data/vcr/vcr_cassettes/{V26 → management}/map/delete.yml +2 -2
  84. data/vcr/vcr_cassettes/{V26 → management}/map/index_all.yml +0 -0
  85. data/vcr/vcr_cassettes/{V26 → management}/map/index_find.yml +0 -0
  86. data/vcr/vcr_cassettes/{V26 → management}/map/index_where.yml +0 -0
  87. data/vcr/vcr_cassettes/{V26 → management}/map/save.yml +0 -0
  88. data/vcr/vcr_cassettes/{V26 → management}/map/save_400.yml +0 -0
  89. data/vcr/vcr_cassettes/{V26 → management}/map/show_find.yml +3 -3
  90. data/vcr/vcr_cassettes/{V26 → management}/map/show_where.yml +0 -0
  91. data/vcr/vcr_cassettes/{V26 → management}/organization/create.yml +0 -0
  92. data/vcr/vcr_cassettes/{V26 → management}/organization/delete.yml +0 -0
  93. data/vcr/vcr_cassettes/{V26 → management}/organization/index.yml +0 -0
  94. data/vcr/vcr_cassettes/{V26 → management}/organization/show.yml +0 -0
  95. data/vcr/vcr_cassettes/{V26 → management}/organization/update.yml +0 -0
  96. data/vcr/vcr_cassettes/{V26 → management}/organization_member/create.yml +0 -0
  97. data/vcr/vcr_cassettes/{V26 → management}/organization_member/delete.yml +0 -0
  98. data/vcr/vcr_cassettes/{V26 → management}/organization_member/index.yml +0 -0
  99. data/vcr/vcr_cassettes/{V26 → management}/organization_member/index_404.yml +0 -0
  100. data/vcr/vcr_cassettes/{V26 → management}/organization_member/index_not_found.yml +0 -0
  101. data/vcr/vcr_cassettes/{V26 → management}/predicate_name/create.yml +0 -0
  102. data/vcr/vcr_cassettes/{V26 → management}/predicate_name/delete.yml +0 -0
  103. data/vcr/vcr_cassettes/{V26 → management}/predicate_name/index.yml +0 -0
  104. data/vcr/vcr_cassettes/{V26 → management}/predicate_name/index_all.yml +0 -0
  105. data/vcr/vcr_cassettes/{V26 → management}/predicate_name/index_find.yml +0 -0
  106. data/vcr/vcr_cassettes/{V26 → management}/predicate_name/index_where.yml +0 -0
  107. data/vcr/vcr_cassettes/{V26 → management}/project/create.yml +0 -0
  108. data/vcr/vcr_cassettes/{V26 → management}/project/create_conflict.yml +0 -0
  109. data/vcr/vcr_cassettes/{V26 → management}/project/delete.yml +0 -0
  110. data/vcr/vcr_cassettes/{V26 → management}/project/index.yml +0 -0
  111. data/vcr/vcr_cassettes/{V26 → management}/project/show.yml +0 -0
  112. data/vcr/vcr_cassettes/{V26 → management}/project_member/create.yml +0 -0
  113. data/vcr/vcr_cassettes/{V26 → management}/project_member/delete.yml +0 -0
  114. data/vcr/vcr_cassettes/{V26 → management}/project_member/index.yml +0 -0
  115. data/vcr/vcr_cassettes/{V26 → management}/project_member/index_403.yml +0 -0
  116. data/vcr/vcr_cassettes/{V26 → management}/project_member/index_not_found.yml +0 -0
  117. data/vcr/vcr_cassettes/{V26 → management}/provider/create.yml +0 -0
  118. data/vcr/vcr_cassettes/{V26 → management}/provider/delete.yml +0 -0
  119. data/vcr/vcr_cassettes/{V26 → management}/provider/index.yml +0 -0
  120. data/vcr/vcr_cassettes/{V26 → management}/provider/show.yml +0 -0
  121. data/vcr/vcr_cassettes/{V26 → management}/scenario/create.yml +0 -0
  122. data/vcr/vcr_cassettes/{V26 → management}/scenario/create_conflict.yml +0 -0
  123. data/vcr/vcr_cassettes/{V26 → management}/scenario/delete.yml +0 -0
  124. data/vcr/vcr_cassettes/{V26 → management}/scenario/deploy.yml +0 -0
  125. data/vcr/vcr_cassettes/{V26 → management}/scenario/download_aiml.yml +0 -0
  126. data/vcr/vcr_cassettes/{V26 → management}/scenario/index.yml +0 -0
  127. data/vcr/vcr_cassettes/{V26 → management}/scenario/show.yml +0 -0
  128. data/vcr/vcr_cassettes/{V26 → management}/scenario/update.yml +0 -0
  129. data/vcr/vcr_cassettes/{V26 → management}/scenario/upload_aiml.yml +0 -0
  130. data/vcr/vcr_cassettes/{V26 → management}/scenario/upload_archive.yml +0 -0
  131. data/vcr/vcr_cassettes/{V26 → management}/scenario/upload_dat.yml +0 -0
  132. data/vcr/vcr_cassettes/{V26 → management}/set/create.yml +0 -0
  133. data/vcr/vcr_cassettes/{V26 → management}/set/create_400.yml +0 -0
  134. data/vcr/vcr_cassettes/{V26 → management}/set/delete.yml +0 -0
  135. data/vcr/vcr_cassettes/{V26 → management}/set/index_all.yml +0 -0
  136. data/vcr/vcr_cassettes/{V26 → management}/set/index_find.yml +0 -0
  137. data/vcr/vcr_cassettes/{V26 → management}/set/index_where.yml +0 -0
  138. data/vcr/vcr_cassettes/{V26 → management}/set/save.yml +0 -0
  139. data/vcr/vcr_cassettes/{V26 → management}/set/save_400.yml +0 -0
  140. data/vcr/vcr_cassettes/{V26 → management}/set/show_find.yml +0 -0
  141. data/vcr/vcr_cassettes/{V26 → management}/set/show_where.yml +0 -0
  142. metadata +170 -270
  143. data/lib/docomo-nlu/management.rb +0 -88
  144. data/lib/docomo-nlu/management/V23/account.rb +0 -30
  145. data/lib/docomo-nlu/management/V23/aiml_base.rb +0 -204
  146. data/lib/docomo-nlu/management/V23/base.rb +0 -88
  147. data/lib/docomo-nlu/management/V23/bot.rb +0 -18
  148. data/lib/docomo-nlu/management/V23/bot_log.rb +0 -8
  149. data/lib/docomo-nlu/management/V23/config.rb +0 -25
  150. data/lib/docomo-nlu/management/V23/default_predicate.rb +0 -15
  151. data/lib/docomo-nlu/management/V23/entry.rb +0 -8
  152. data/lib/docomo-nlu/management/V23/log.rb +0 -8
  153. data/lib/docomo-nlu/management/V23/map.rb +0 -10
  154. data/lib/docomo-nlu/management/V23/multipart_base.rb +0 -83
  155. data/lib/docomo-nlu/management/V23/ng_word.rb +0 -10
  156. data/lib/docomo-nlu/management/V23/ok_word.rb +0 -10
  157. data/lib/docomo-nlu/management/V23/organization.rb +0 -23
  158. data/lib/docomo-nlu/management/V23/organization_member.rb +0 -15
  159. data/lib/docomo-nlu/management/V23/predicate_name.rb +0 -15
  160. data/lib/docomo-nlu/management/V23/project.rb +0 -16
  161. data/lib/docomo-nlu/management/V23/project_member.rb +0 -15
  162. data/lib/docomo-nlu/management/V23/property.rb +0 -10
  163. data/lib/docomo-nlu/management/V23/provider.rb +0 -17
  164. data/lib/docomo-nlu/management/V23/scenario.rb +0 -29
  165. data/lib/docomo-nlu/management/V23/scenario_project.rb +0 -10
  166. data/lib/docomo-nlu/management/V23/scenario_util.rb +0 -30
  167. data/lib/docomo-nlu/management/V23/set.rb +0 -10
  168. data/lib/docomo-nlu/management/V23/task_project.rb +0 -20
  169. data/lib/docomo-nlu/management/V26/multipart_base.rb +0 -83
  170. data/vcr/vcr_cassettes/V23/account/count.yml +0 -42
  171. data/vcr/vcr_cassettes/V23/account/create.yml +0 -44
  172. data/vcr/vcr_cassettes/V23/account/delete.yml +0 -38
  173. data/vcr/vcr_cassettes/V23/account/index.yml +0 -43
  174. data/vcr/vcr_cassettes/V23/account/show.yml +0 -43
  175. data/vcr/vcr_cassettes/V23/account/update.yml +0 -41
  176. data/vcr/vcr_cassettes/V23/base/login.yml +0 -44
  177. data/vcr/vcr_cassettes/V23/base/login_400.yml +0 -42
  178. data/vcr/vcr_cassettes/V23/base/logout.yml +0 -40
  179. data/vcr/vcr_cassettes/V23/base/logout_400.yml +0 -40
  180. data/vcr/vcr_cassettes/V23/bot/create.yml +0 -43
  181. data/vcr/vcr_cassettes/V23/bot/create_conflict.yml +0 -45
  182. data/vcr/vcr_cassettes/V23/bot/delete.yml +0 -38
  183. data/vcr/vcr_cassettes/V23/bot/deploy.yml +0 -164
  184. data/vcr/vcr_cassettes/V23/bot/download_aiml.yml +0 -43
  185. data/vcr/vcr_cassettes/V23/bot/download_archive.yml +0 -43
  186. data/vcr/vcr_cassettes/V23/bot/download_dat.yml +0 -43
  187. data/vcr/vcr_cassettes/V23/bot/index.yml +0 -44
  188. data/vcr/vcr_cassettes/V23/bot/index_not_found.yml +0 -42
  189. data/vcr/vcr_cassettes/V23/bot/show.yml +0 -43
  190. data/vcr/vcr_cassettes/V23/bot/upload_aiml.yml +0 -45
  191. data/vcr/vcr_cassettes/V23/bot/upload_archive.yml +0 -46
  192. data/vcr/vcr_cassettes/V23/bot/upload_dat.yml +0 -46
  193. data/vcr/vcr_cassettes/V23/config/delete.yml +0 -38
  194. data/vcr/vcr_cassettes/V23/config/index.yml +0 -120
  195. data/vcr/vcr_cassettes/V23/config/update.yml +0 -42
  196. data/vcr/vcr_cassettes/V23/default_predicate/create.yml +0 -42
  197. data/vcr/vcr_cassettes/V23/default_predicate/delete.yml +0 -38
  198. data/vcr/vcr_cassettes/V23/default_predicate/index.yml +0 -120
  199. data/vcr/vcr_cassettes/V23/default_predicate/index_not_found.yml +0 -120
  200. data/vcr/vcr_cassettes/V23/default_predicate/update.yml +0 -40
  201. data/vcr/vcr_cassettes/V23/map/create.yml +0 -45
  202. data/vcr/vcr_cassettes/V23/map/create_400.yml +0 -48
  203. data/vcr/vcr_cassettes/V23/map/delete.yml +0 -38
  204. data/vcr/vcr_cassettes/V23/map/index_all.yml +0 -43
  205. data/vcr/vcr_cassettes/V23/map/index_find.yml +0 -43
  206. data/vcr/vcr_cassettes/V23/map/index_where.yml +0 -43
  207. data/vcr/vcr_cassettes/V23/map/save.yml +0 -45
  208. data/vcr/vcr_cassettes/V23/map/save_400.yml +0 -48
  209. data/vcr/vcr_cassettes/V23/map/show_find.yml +0 -43
  210. data/vcr/vcr_cassettes/V23/map/show_where.yml +0 -43
  211. data/vcr/vcr_cassettes/V23/organization/create.yml +0 -44
  212. data/vcr/vcr_cassettes/V23/organization/delete.yml +0 -38
  213. data/vcr/vcr_cassettes/V23/organization/index.yml +0 -138
  214. data/vcr/vcr_cassettes/V23/organization/show.yml +0 -42
  215. data/vcr/vcr_cassettes/V23/organization/update.yml +0 -40
  216. data/vcr/vcr_cassettes/V23/organization_member/create.yml +0 -42
  217. data/vcr/vcr_cassettes/V23/organization_member/delete.yml +0 -38
  218. data/vcr/vcr_cassettes/V23/organization_member/index.yml +0 -42
  219. data/vcr/vcr_cassettes/V23/organization_member/index_404.yml +0 -42
  220. data/vcr/vcr_cassettes/V23/organization_member/index_not_found.yml +0 -42
  221. data/vcr/vcr_cassettes/V23/predicate_name/create.yml +0 -42
  222. data/vcr/vcr_cassettes/V23/predicate_name/delete.yml +0 -38
  223. data/vcr/vcr_cassettes/V23/predicate_name/index.yml +0 -42
  224. data/vcr/vcr_cassettes/V23/predicate_name/index_all.yml +0 -42
  225. data/vcr/vcr_cassettes/V23/predicate_name/index_find.yml +0 -42
  226. data/vcr/vcr_cassettes/V23/predicate_name/index_where.yml +0 -42
  227. data/vcr/vcr_cassettes/V23/project/create.yml +0 -44
  228. data/vcr/vcr_cassettes/V23/project/create_conflict.yml +0 -44
  229. data/vcr/vcr_cassettes/V23/project/delete.yml +0 -38
  230. data/vcr/vcr_cassettes/V23/project/index.yml +0 -474
  231. data/vcr/vcr_cassettes/V23/project/show.yml +0 -43
  232. data/vcr/vcr_cassettes/V23/project_member/create.yml +0 -42
  233. data/vcr/vcr_cassettes/V23/project_member/delete.yml +0 -38
  234. data/vcr/vcr_cassettes/V23/project_member/index.yml +0 -42
  235. data/vcr/vcr_cassettes/V23/project_member/index_403.yml +0 -40
  236. data/vcr/vcr_cassettes/V23/project_member/index_not_found.yml +0 -42
  237. data/vcr/vcr_cassettes/V23/provider/create.yml +0 -44
  238. data/vcr/vcr_cassettes/V23/provider/delete.yml +0 -38
  239. data/vcr/vcr_cassettes/V23/provider/index.yml +0 -42
  240. data/vcr/vcr_cassettes/V23/provider/show.yml +0 -42
  241. data/vcr/vcr_cassettes/V23/scenario/create.yml +0 -42
  242. data/vcr/vcr_cassettes/V23/scenario/create_conflict.yml +0 -44
  243. data/vcr/vcr_cassettes/V23/scenario/delete.yml +0 -38
  244. data/vcr/vcr_cassettes/V23/scenario/deploy.yml +0 -164
  245. data/vcr/vcr_cassettes/V23/scenario/download_aiml.yml +0 -43
  246. data/vcr/vcr_cassettes/V23/scenario/index.yml +0 -43
  247. data/vcr/vcr_cassettes/V23/scenario/show.yml +0 -42
  248. data/vcr/vcr_cassettes/V23/scenario/update.yml +0 -40
  249. data/vcr/vcr_cassettes/V23/scenario/upload_aiml.yml +0 -45
  250. data/vcr/vcr_cassettes/V23/scenario/upload_archive.yml +0 -46
  251. data/vcr/vcr_cassettes/V23/scenario/upload_dat.yml +0 -46
  252. data/vcr/vcr_cassettes/V23/set/create.yml +0 -45
  253. data/vcr/vcr_cassettes/V23/set/create_400.yml +0 -48
  254. data/vcr/vcr_cassettes/V23/set/delete.yml +0 -38
  255. data/vcr/vcr_cassettes/V23/set/index_all.yml +0 -43
  256. data/vcr/vcr_cassettes/V23/set/index_find.yml +0 -43
  257. data/vcr/vcr_cassettes/V23/set/index_where.yml +0 -43
  258. data/vcr/vcr_cassettes/V23/set/save.yml +0 -45
  259. data/vcr/vcr_cassettes/V23/set/save_400.yml +0 -48
  260. data/vcr/vcr_cassettes/V23/set/show_find.yml +0 -43
  261. data/vcr/vcr_cassettes/V23/set/show_where.yml +0 -43
@@ -1,88 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DocomoNlu
4
- module Management
5
- NAMESPACE = ((DocomoNlu.config.nlu_version == "v2.6") ? "V26" : "V23").freeze
6
-
7
- module V23
8
- autoload :Account, "docomo-nlu/management/V23/account"
9
- autoload :AIMLBase, "docomo-nlu/management/V23/aiml_base"
10
- autoload :Base, "docomo-nlu/management/V23/base"
11
- autoload :Bot, "docomo-nlu/management/V23/bot"
12
- autoload :BotLog, "docomo-nlu/management/V23/bot_log"
13
- autoload :Config, "docomo-nlu/management/V23/config"
14
- autoload :DefaultPredicate, "docomo-nlu/management/V23/default_predicate"
15
- autoload :Entry, "docomo-nlu/management/V23/entry"
16
- autoload :Log, "docomo-nlu/management/V23/log"
17
- autoload :MultipartBase, "docomo-nlu/management/V23/multipart_base"
18
- autoload :Map, "docomo-nlu/management/V23/map"
19
- autoload :NGWord, "docomo-nlu/management/V23/ng_word"
20
- autoload :OKWord, "docomo-nlu/management/V23/ok_word"
21
- autoload :OrganizationMember, "docomo-nlu/management/V23/organization_member"
22
- autoload :Organization, "docomo-nlu/management/V23/organization"
23
- autoload :PredicateName, "docomo-nlu/management/V23/predicate_name"
24
- autoload :ProjectMember, "docomo-nlu/management/V23/project_member"
25
- autoload :Project, "docomo-nlu/management/V23/project"
26
- autoload :Property, "docomo-nlu/management/V23/property"
27
- autoload :Provider, "docomo-nlu/management/V23/provider"
28
- autoload :ScenarioProject, "docomo-nlu/management/V23/scenario_project"
29
- autoload :ScenarioUtil, "docomo-nlu/management/V23/scenario_util"
30
- autoload :Scenario, "docomo-nlu/management/V23/scenario"
31
- autoload :Set, "docomo-nlu/management/V23/set"
32
- autoload :TaskProject, "docomo-nlu/management/V23/task_project"
33
- end
34
- module V26
35
- autoload :Account, "docomo-nlu/management/V26/account"
36
- autoload :AIMLBase, "docomo-nlu/management/V26/aiml_base"
37
- autoload :Base, "docomo-nlu/management/V26/base"
38
- autoload :Bot, "docomo-nlu/management/V26/bot"
39
- autoload :BotLog, "docomo-nlu/management/V26/bot_log"
40
- autoload :Config, "docomo-nlu/management/V26/config"
41
- autoload :DefaultPredicate, "docomo-nlu/management/V26/default_predicate"
42
- autoload :Entry, "docomo-nlu/management/V26/entry"
43
- autoload :Log, "docomo-nlu/management/V26/log"
44
- autoload :MultipartBase, "docomo-nlu/management/V26/multipart_base"
45
- autoload :Map, "docomo-nlu/management/V26/map"
46
- autoload :NGWord, "docomo-nlu/management/V26/ng_word"
47
- autoload :OKWord, "docomo-nlu/management/V26/ok_word"
48
- autoload :OrganizationMember, "docomo-nlu/management/V26/organization_member"
49
- autoload :Organization, "docomo-nlu/management/V26/organization"
50
- autoload :PredicateName, "docomo-nlu/management/V26/predicate_name"
51
- autoload :ProjectMember, "docomo-nlu/management/V26/project_member"
52
- autoload :Project, "docomo-nlu/management/V26/project"
53
- autoload :Property, "docomo-nlu/management/V26/property"
54
- autoload :Provider, "docomo-nlu/management/V26/provider"
55
- autoload :ScenarioProject, "docomo-nlu/management/V26/scenario_project"
56
- autoload :ScenarioUtil, "docomo-nlu/management/V26/scenario_util"
57
- autoload :Scenario, "docomo-nlu/management/V26/scenario"
58
- autoload :Set, "docomo-nlu/management/V26/set"
59
- autoload :TaskProject, "docomo-nlu/management/V26/task_project"
60
- end
61
-
62
- Account = const_get "DocomoNlu::Management::#{NAMESPACE}::Account"
63
- AIMLBase = const_get "DocomoNlu::Management::#{NAMESPACE}::Account"
64
- Base = const_get "DocomoNlu::Management::#{NAMESPACE}::Base"
65
- Bot = const_get "DocomoNlu::Management::#{NAMESPACE}::Bot"
66
- BotLog = const_get "DocomoNlu::Management::#{NAMESPACE}::BotLog"
67
- Config = const_get "DocomoNlu::Management::#{NAMESPACE}::Config"
68
- Entry = const_get "DocomoNlu::Management::#{NAMESPACE}::Entry"
69
- Log = const_get "DocomoNlu::Management::#{NAMESPACE}::Log"
70
- DefaultPredicate = const_get "DocomoNlu::Management::#{NAMESPACE}::DefaultPredicate"
71
- MultipartBase = const_get "DocomoNlu::Management::#{NAMESPACE}::MultipartBase"
72
- Map = const_get "DocomoNlu::Management::#{NAMESPACE}::Map"
73
- NGWord = const_get "DocomoNlu::Management::#{NAMESPACE}::NGWord"
74
- OKWord = const_get "DocomoNlu::Management::#{NAMESPACE}::OKWord"
75
- OrganizationMember = const_get "DocomoNlu::Management::#{NAMESPACE}::OrganizationMember"
76
- Organization = const_get "DocomoNlu::Management::#{NAMESPACE}::Organization"
77
- PredicateName = const_get "DocomoNlu::Management::#{NAMESPACE}::PredicateName"
78
- ProjectMember = const_get "DocomoNlu::Management::#{NAMESPACE}::ProjectMember"
79
- Project = const_get "DocomoNlu::Management::#{NAMESPACE}::Project"
80
- Property = const_get "DocomoNlu::Management::#{NAMESPACE}::Property"
81
- Provider = const_get "DocomoNlu::Management::#{NAMESPACE}::Provider"
82
- ScenarioProject = const_get "DocomoNlu::Management::#{NAMESPACE}::ScenarioProject"
83
- ScenarioUtil = const_get "DocomoNlu::Management::#{NAMESPACE}::ScenarioUtil"
84
- Scenario = const_get "DocomoNlu::Management::#{NAMESPACE}::Scenario"
85
- Set = const_get "DocomoNlu::Management::#{NAMESPACE}::Set"
86
- TaskProject = const_get "DocomoNlu::Management::#{NAMESPACE}::TaskProject"
87
- end
88
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DocomoNlu
4
- module Management::V23
5
- class Account < Base
6
- self.element_name = "accounts"
7
- self.prefix = "/management/v2.2/"
8
-
9
- # Parameter for create
10
- # {
11
- # "accountName": "your account name",
12
- # "password": "your account password",
13
- # "description": "account description",
14
- # "authorization": 2,
15
- # "enable": true
16
- # }
17
-
18
- def self.count
19
- response_body = JSON.parse(connection.get("#{prefix}#{element_name}/count", headers).body)
20
- response_body["count"]
21
- end
22
-
23
- def to_json(options = {})
24
- enable_params = ["accountName", "password", "description", "authorization", "enable"]
25
- attributes.select! {|a| enable_params.include?(a) }
26
- super
27
- end
28
- end
29
- end
30
- end
@@ -1,204 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # download([:aiml,:dat,:archive],scenarioId)
4
- # GET /{projectId}/bots/{botId}/aiml/{scenarioId}
5
- # GET /{projectId}/bots/{botId}/dat
6
- # GET /{projectId}/bots/{botId}/archive
7
-
8
- # upload([:aiml,:dat,:archive],filepath)
9
- # /{projectId}/bots/{botId}/aiml
10
- # /{projectId}/bots/{botId}/dat
11
- # /{projectId}/bots/{botId}/archive
12
-
13
- # Not supported
14
- # GET /{projectId}/bots/{botId}/archive/aiml
15
-
16
- # require 'rubyzip'
17
-
18
- require "tempfile"
19
- module DocomoNlu
20
- module Management::V23
21
- class AIMLBase < Base
22
- ## For AIML
23
-
24
- def download(extra_path = "")
25
- prefix_options[:bot_id] ||= botId
26
- @attributes[:file] = self.class.download(prefix_options, extra_path).file
27
- end
28
-
29
- def upload(file, type = :aiml)
30
- prefix_options[:bot_id] ||= botId
31
- prefix_options[:method] ||= type
32
- self.class.upload(file, prefix_options)
33
- end
34
-
35
- def compile
36
- prefix_options[:bot_id] ||= botId
37
- self.class.compile(prefix_options)
38
- end
39
-
40
- def transfer
41
- prefix_options[:bot_id] ||= botId
42
- self.class.deploy_request(prefix_options)
43
- end
44
-
45
- def deploy
46
- prefix_options[:bot_id] ||= botId
47
- self.class.deploy(prefix_options)
48
- end
49
-
50
- ## For FAQ
51
-
52
- def upload_userdic(file)
53
- prefix_options[:bot_id] ||= botId
54
- prefix_options[:method] = "userDic"
55
- self.class.upload(file, prefix_options, FAQModel)
56
- end
57
-
58
- def upload_stopkey(file)
59
- prefix_options[:bot_id] ||= botId
60
- prefix_options[:method] = "stopkey"
61
- self.class.upload(file, prefix_options, FAQModel)
62
- end
63
-
64
- def download_stopkey
65
- prefix_options[:bot_id] ||= botId
66
- prefix_options[:method] = "stopkey"
67
- @attributes[:stopkey] = self.class.download(prefix_options, FAQModel).file
68
- end
69
-
70
- def upload_truthlist(file)
71
- prefix_options[:bot_id] ||= botId
72
- prefix_options[:method] = "truthlist"
73
- self.class.upload(file, prefix_options, FAQModel)
74
- end
75
-
76
- def download_truthlist
77
- prefix_options[:bot_id] ||= botId
78
- prefix_options[:method] = "truthlist"
79
- @attributes[:truthlist] = self.class.download(prefix_options, FAQModel).file
80
- end
81
-
82
- def upload_entry(file)
83
- prefix_options[:bot_id] ||= botId
84
- prefix_options[:method] = "entry"
85
- self.class.upload(file, prefix_options, FAQModel)
86
- end
87
-
88
- def check_faq_status(method)
89
- prefix_options[:bot_id] ||= botId
90
- prefix_options[:method] = method
91
- self.class.check_status(:faq, "#{FileModel.collection_path(prefix_options)}/status")
92
- end
93
-
94
- class << self
95
- def download(prefix_options, extra_path = "", model = FileModel)
96
- conn = Faraday.new(url: site.to_s, ssl: { verify: false }) do |builder|
97
- builder.adapter :net_http
98
- end
99
- conn.headers["Authorization"] = access_token
100
- response = conn.get("#{model.collection_path(prefix_options)}/#{extra_path}")
101
-
102
- if check_response(response)
103
- instantiate_record({}, prefix_options).tap do |record|
104
- record.file = Tempfile.open(["docomo-nlu", ".#{prefix_options[:method]}"]) do |f|
105
- f.write response.body.force_encoding("UTF-8")
106
- f
107
- end
108
- end
109
- end
110
- end
111
-
112
- def upload(file, prefix_options, model = FileModel)
113
- conn = Faraday.new(url: site.to_s, ssl: { verify: false }) do |builder|
114
- builder.request :multipart # マルチパートでデータを送信
115
- builder.request :url_encoded
116
- builder.adapter :net_http
117
- end
118
- conn.headers["Authorization"] = access_token
119
- params = {
120
- uploadFile: Faraday::UploadIO.new(file.path, "text/plain"),
121
- }
122
- response = conn.put model.collection_path(prefix_options), params
123
- check_response(response)
124
- end
125
-
126
- def compile(prefix_options)
127
- return if deploy_request(:compile, prefix_options) != ""
128
- end
129
-
130
- def transfer(prefix_options)
131
- return if deploy_request(:transfer, prefix_options) != ""
132
- end
133
-
134
- def deploy_request(method, prefix_options)
135
- response_body = JSON.parse(connection.post(Scenario.element_path(method, prefix_options), "", headers).body)
136
- # Sometimes, API returns wrong url, replace correct path.
137
- URI.parse(response_body["statusUri"]).path.gsub!(/NLPManagementAPI/, "management/v2.2")
138
- end
139
-
140
- def deploy(prefix_options)
141
- # compile and status check
142
- compile_status = false
143
- check_path = deploy_request(:compile, prefix_options)
144
- while check_path && compile_status != "Completed"
145
- sleep(0.2)
146
- compile_status = check_status(:compile, check_path)
147
- raise ActiveResource::ServerError if %w[ErrorFinish NotCompiled].include?(compile_status)
148
- end
149
-
150
- # transfer and status check
151
- transfer_status = false
152
- check_path = deploy_request(:transfer, prefix_options)
153
- while check_path && transfer_status != "Completed"
154
- sleep(0.2)
155
- transfer_status = check_status(:transfer, check_path)
156
- raise ActiveResource::ServerError if %w[ErrorFinish NotTransfered].include?(transfer_status)
157
- end
158
- true
159
- end
160
-
161
- def check_status(method, path)
162
- case method
163
- when :compile, :faq then JSON.parse(connection.get(path, headers).body)["status"]
164
- when :transfer then JSON.parse(connection.get(path, headers).body)["transferStatusResponses"][0]["status"]
165
- end
166
- end
167
-
168
- # def generate_file(response, method)
169
- # case method
170
- # when :aiml, :dat then
171
- # Tempfile.open(["docomo-nlu", ".#{prefix_options[:method].to_s}"]) do |f|
172
- # f.write response.body.force_encoding("UTF-8")
173
- # f
174
- # end
175
- # when :zip then
176
- # zip_file = Tempfile.new(["docomo-nlu", ".#{prefix_options[:method].to_s.gsub(/archive/, "zip")}"])
177
- # Zip::OutputStream.open(zip_file.path) do |zip|
178
- # @targets.each do |target|
179
- # zip.put_next_entry("#{target.filename}.pdf")
180
- # zip.print Net::HTTP.get URI.parse(target.url)
181
- # end
182
- # end
183
- # Zip::File.open_buffer(file.read) do |zf|
184
- # zf.each do |entry|
185
- # p entry.name # ファイル名
186
- # p entry.get_input_stream.read # ファイルの中身
187
- # end
188
- # end
189
- # end
190
- # end
191
- end
192
-
193
- class FileModel < Base
194
- self.element_name = ""
195
- self.prefix = "/management/v2.2/projects/:project_id/bots/:bot_id/:method"
196
- end
197
-
198
- class FAQModel < Base
199
- self.element_name = ""
200
- self.prefix = "/faqmanagement/v2.2/projects/:project_id/bots/:bot_id/:method"
201
- end
202
- end
203
- end
204
- end
@@ -1,88 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "net/http"
4
-
5
- module DocomoNlu
6
- module Management::V23
7
- class Base < ActiveResource::Base
8
- ## For Dynamically generated headers via http://rmosolgo.github.io/blog/2014/02/05/dynamically-generated-headers-for-activeresource-requests/
9
- cattr_accessor :static_headers
10
- cattr_accessor :access_token
11
-
12
- ## Dynamic headers
13
- self.static_headers = headers
14
-
15
- ## Admin Accesstoken
16
- self.access_token = DocomoNlu.config.admin_access_token
17
-
18
- ## Setting Endpoint.
19
- self.site = DocomoNlu.config.nlu_host
20
-
21
- ## Remove format in path (remove .json)
22
- self.include_format_in_path = false
23
-
24
- self.format = :json
25
-
26
- ## Get NLPManagement's AccessToken.
27
- def login(account_name, password)
28
- request_body = { accountName: account_name, password: password }.to_json
29
- response_body = JSON.parse(connection.post("/management/v2.2/login", request_body, self.class.headers).body)
30
- self.access_token = response_body["accessToken"]
31
- end
32
-
33
- ## Delete NLPManagement's AccessToken.
34
- def logout
35
- res = connection.get("/management/v2.2/logout", self.class.headers) if access_token.present?
36
- raise ActiveResource::BadRequest, "Invalid access token" unless res
37
-
38
- self.access_token = nil
39
- true
40
- end
41
-
42
- ## Override. Insert generated id to parameter 'id' after save or create
43
- def id_from_response(response)
44
- ActiveSupport::JSON.decode(response.body)["#{self.class.to_s.split("::").last.downcase!}Id"] if response.body.present?
45
- end
46
-
47
- class << self
48
- def instantiate_collection(collection, original_params = {}, prefix_options = {})
49
- if collection.is_a?(Hash)
50
- collection = if collection.empty? || collection.first[1].nil?
51
- []
52
- else
53
- [collection]
54
- end
55
- elsif collection[0].is_a?(String)
56
- collection = [{ params: collection }]
57
- end
58
- super
59
- end
60
-
61
- def instantiate_record(record, prefix_options = {})
62
- record = record[0] if record.is_a?(Array)
63
- resource_id = record["#{to_s.split("::").last.downcase!}Id"]
64
- record["id"] = resource_id if resource_id
65
- super
66
- end
67
-
68
- def headers
69
- new_headers = static_headers.clone
70
- new_headers["Authorization"] = access_token
71
- new_headers
72
- end
73
-
74
- def check_response(response)
75
- case response.status
76
- when 400 then raise ActiveResource::BadRequest, response
77
- when 401 then raise ActiveResource::UnauthorizedAccess, response
78
- when 403 then raise ActiveResource::ForbiddenAccess, response
79
- when 404 then raise ActiveResource::ResourceNotFound, response
80
- when 409 then raise ActiveResource::ResourceConflict, response
81
- when 503 then raise ActiveResource::ServerError, response
82
- when 200..204 then true
83
- end
84
- end
85
- end
86
- end
87
- end
88
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DocomoNlu
4
- module Management::V23
5
- class Bot < AIMLBase
6
- self.element_name = "bots"
7
- self.prefix = "/management/v2.2/projects/:project_id/"
8
-
9
- # Parameter for create
10
- # {
11
- # "botId": "botid",
12
- # "scenarioProjectId", "DSU",
13
- # "language": "ja-JP",
14
- # "description": "hello"
15
- # }
16
- end
17
- end
18
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DocomoNlu
4
- module Management::V23
5
- class BotLog < Base
6
- end
7
- end
8
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DocomoNlu
4
- module Management::V23
5
- class Config < Base
6
- self.element_name = "configs"
7
- self.prefix = "/management/v2.2/projects/:project_id/bots/:bot_id/"
8
-
9
- # {
10
- # "dialogTimeout": 300,
11
- # "replyTimeout": 300,
12
- # "xxxxUrl": "http://xxx",
13
- # "yyyyUrl": "http://xxx",
14
- # "sensitiveInfo": "aa.bb, ccc.ddd...",
15
- # "sraix" : [true|false],
16
- # "taskServerUrl": "http://xxx"
17
- # }
18
-
19
- def destroy(keys)
20
- self.id = keys.join(",")
21
- super()
22
- end
23
- end
24
- end
25
- end