myask 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/myask/prompt_helper.rb +3 -0
  4. data/lib/myask/version.rb +1 -1
  5. data/pkg/myask-0.0.1/Gemfile.lock +1 -1
  6. data/pkg/myask-0.0.1/lib/myask/prompt_helper.rb +3 -0
  7. data/pkg/myask-0.0.1/lib/myask/version.rb +1 -1
  8. data/pkg/myask-1.0.0/Gemfile +10 -0
  9. data/pkg/myask-1.0.0/Gemfile.lock +70 -0
  10. data/pkg/myask-1.0.0/README.rdoc +6 -0
  11. data/pkg/myask-1.0.0/Rakefile +21 -0
  12. data/pkg/myask-1.0.0/bin/myask +101 -0
  13. data/pkg/myask-1.0.0/html/App.html +116 -0
  14. data/pkg/myask-1.0.0/html/MyAsk/Api/Helper.html +207 -0
  15. data/pkg/myask-1.0.0/html/MyAsk/Api/Invitation.html +212 -0
  16. data/pkg/myask-1.0.0/html/MyAsk/Api/Project.html +355 -0
  17. data/pkg/myask-1.0.0/html/MyAsk/Api/ProjectHelper.html +299 -0
  18. data/pkg/myask-1.0.0/html/MyAsk/Api/Question.html +261 -0
  19. data/pkg/myask-1.0.0/html/MyAsk/Api.html +120 -0
  20. data/pkg/myask-1.0.0/html/MyAsk/Config.html +195 -0
  21. data/pkg/myask-1.0.0/html/MyAsk/ConfigHelper.html +251 -0
  22. data/pkg/myask-1.0.0/html/MyAsk/Prompt.html +221 -0
  23. data/pkg/myask-1.0.0/html/MyAsk/PromptHelper.html +330 -0
  24. data/pkg/myask-1.0.0/html/MyAsk.html +114 -0
  25. data/pkg/myask-1.0.0/html/README_rdoc.html +394 -0
  26. data/pkg/myask-1.0.0/html/created.rid +14 -0
  27. data/pkg/myask-1.0.0/html/css/fonts.css +167 -0
  28. data/pkg/myask-1.0.0/html/css/rdoc.css +681 -0
  29. data/pkg/myask-1.0.0/html/fonts/Lato-Light.ttf +0 -0
  30. data/pkg/myask-1.0.0/html/fonts/Lato-LightItalic.ttf +0 -0
  31. data/pkg/myask-1.0.0/html/fonts/Lato-Regular.ttf +0 -0
  32. data/pkg/myask-1.0.0/html/fonts/Lato-RegularItalic.ttf +0 -0
  33. data/pkg/myask-1.0.0/html/fonts/SourceCodePro-Bold.ttf +0 -0
  34. data/pkg/myask-1.0.0/html/fonts/SourceCodePro-Regular.ttf +0 -0
  35. data/pkg/myask-1.0.0/html/images/add.png +0 -0
  36. data/pkg/myask-1.0.0/html/images/arrow_up.png +0 -0
  37. data/pkg/myask-1.0.0/html/images/brick.png +0 -0
  38. data/pkg/myask-1.0.0/html/images/brick_link.png +0 -0
  39. data/pkg/myask-1.0.0/html/images/bug.png +0 -0
  40. data/pkg/myask-1.0.0/html/images/bullet_black.png +0 -0
  41. data/pkg/myask-1.0.0/html/images/bullet_toggle_minus.png +0 -0
  42. data/pkg/myask-1.0.0/html/images/bullet_toggle_plus.png +0 -0
  43. data/pkg/myask-1.0.0/html/images/date.png +0 -0
  44. data/pkg/myask-1.0.0/html/images/delete.png +0 -0
  45. data/pkg/myask-1.0.0/html/images/find.png +0 -0
  46. data/pkg/myask-1.0.0/html/images/loadingAnimation.gif +0 -0
  47. data/pkg/myask-1.0.0/html/images/macFFBgHack.png +0 -0
  48. data/pkg/myask-1.0.0/html/images/package.png +0 -0
  49. data/pkg/myask-1.0.0/html/images/page_green.png +0 -0
  50. data/pkg/myask-1.0.0/html/images/page_white_text.png +0 -0
  51. data/pkg/myask-1.0.0/html/images/page_white_width.png +0 -0
  52. data/pkg/myask-1.0.0/html/images/plugin.png +0 -0
  53. data/pkg/myask-1.0.0/html/images/ruby.png +0 -0
  54. data/pkg/myask-1.0.0/html/images/tag_blue.png +0 -0
  55. data/pkg/myask-1.0.0/html/images/tag_green.png +0 -0
  56. data/pkg/myask-1.0.0/html/images/transparent.png +0 -0
  57. data/pkg/myask-1.0.0/html/images/wrench.png +0 -0
  58. data/pkg/myask-1.0.0/html/images/wrench_orange.png +0 -0
  59. data/pkg/myask-1.0.0/html/images/zoom.png +0 -0
  60. data/pkg/myask-1.0.0/html/index.html +403 -0
  61. data/pkg/myask-1.0.0/html/js/darkfish.js +120 -0
  62. data/pkg/myask-1.0.0/html/js/navigation.js +105 -0
  63. data/pkg/myask-1.0.0/html/js/navigation.js.gz +0 -0
  64. data/pkg/myask-1.0.0/html/js/search.js +110 -0
  65. data/pkg/myask-1.0.0/html/js/search_index.js +1 -0
  66. data/pkg/myask-1.0.0/html/js/search_index.js.gz +0 -0
  67. data/pkg/myask-1.0.0/html/js/searcher.js +229 -0
  68. data/pkg/myask-1.0.0/html/js/searcher.js.gz +0 -0
  69. data/pkg/myask-1.0.0/html/table_of_contents.html +257 -0
  70. data/pkg/myask-1.0.0/lib/myask/api/api_helper.rb +45 -0
  71. data/pkg/myask-1.0.0/lib/myask/api/invitation.rb +49 -0
  72. data/pkg/myask-1.0.0/lib/myask/api/project.rb +193 -0
  73. data/pkg/myask-1.0.0/lib/myask/api/project_helper.rb +46 -0
  74. data/pkg/myask-1.0.0/lib/myask/api/question.rb +99 -0
  75. data/pkg/myask-1.0.0/lib/myask/config.rb +37 -0
  76. data/pkg/myask-1.0.0/lib/myask/config_helper.rb +28 -0
  77. data/pkg/myask-1.0.0/lib/myask/prompt.rb +63 -0
  78. data/pkg/myask-1.0.0/lib/myask/prompt_helper.rb +83 -0
  79. data/pkg/myask-1.0.0/lib/myask/version.rb +3 -0
  80. data/pkg/myask-1.0.0/lib/myask.rb +28 -0
  81. data/pkg/myask-1.0.0/myask.gemspec +22 -0
  82. data/pkg/myask-1.0.0/myask.rdoc +138 -0
  83. data/pkg/myask-1.0.0/pkg/myask-0.0.1/Gemfile +10 -0
  84. data/pkg/myask-1.0.0/pkg/myask-0.0.1/Gemfile.lock +70 -0
  85. data/pkg/myask-1.0.0/pkg/myask-0.0.1/README.rdoc +6 -0
  86. data/pkg/myask-1.0.0/pkg/myask-0.0.1/Rakefile +21 -0
  87. data/pkg/myask-1.0.0/pkg/myask-0.0.1/bin/myask +101 -0
  88. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/api_helper.rb +45 -0
  89. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/invitation.rb +49 -0
  90. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/project.rb +193 -0
  91. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/project_helper.rb +46 -0
  92. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/question.rb +99 -0
  93. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/config.rb +37 -0
  94. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/config_helper.rb +28 -0
  95. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/prompt.rb +63 -0
  96. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/prompt_helper.rb +83 -0
  97. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/version.rb +3 -0
  98. data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask.rb +28 -0
  99. data/pkg/myask-1.0.0/pkg/myask-0.0.1/myask.gemspec +22 -0
  100. data/pkg/myask-1.0.0/pkg/myask-0.0.1/myask.rdoc +138 -0
  101. data/pkg/myask-1.0.0/pkg/myask-0.0.1/test/default_test.rb +14 -0
  102. data/pkg/myask-1.0.0/pkg/myask-0.0.1/test/test_helper.rb +4 -0
  103. data/pkg/myask-1.0.0/pkg/myask-0.0.1.gem +0 -0
  104. data/pkg/myask-1.0.0/test/default_test.rb +14 -0
  105. data/pkg/myask-1.0.0/test/test_helper.rb +4 -0
  106. data/pkg/myask-1.0.0.gem +0 -0
  107. metadata +101 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc3caee60e902b2c8700ce1acb4c5c10d5171c851028b079a10241820e7cf51e
4
- data.tar.gz: 88d6ca39a162d0affe27f3dbbfa8f85c73d1dea61f2751eb9f661e5af6bff2c5
3
+ metadata.gz: ff4726b6be34b825c282f02dda2cffb42ed8dd7736cf676a1a058f554cb4ee57
4
+ data.tar.gz: 97b39f56842b0bec07a706a95716822cbaa74369ce946dbdaa567ae0a2f3a818
5
5
  SHA512:
6
- metadata.gz: 285e65b22a9cdc8866ca3f56dc466bb72ad9ba9addce2ed46215d35e977645dd8ae252e351a78152ca78bdc5fd7fb36df6c1aef5de5c96d41e21ae535e4fba40
7
- data.tar.gz: 78771907c03e8eb8d67aa708d1c651316f10053713c71c67e7c5b2b2f4b60c877bd921eb68aaa97872d43794d9c1b92f75738bb94f700d2cd9f99381617ce321
6
+ metadata.gz: fba02d462a19e6140d552c9dfedabcf934ae05f36b1970875820590a8aa591b33820842cbc603ae5699ae5aaac9b31f6ff14e65c64301df00e75805c6c5b04e6
7
+ data.tar.gz: 680957caf1bbfc201b8402af8af8eed10237ca451f327c7ad89bb6cfe0744a7fb662ff2cbd58a85e652ed848ea26c14cc22e1c567873ac09985d17e1e1820ba4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- myask (1.0.0)
4
+ myask (1.1.0)
5
5
  gli (~> 2.22.2)
6
6
 
7
7
  GEM
@@ -59,9 +59,12 @@ module MyAsk
59
59
  def get_initial_question
60
60
  file_contents = []
61
61
 
62
+ current_directory = Dir.pwd
63
+
62
64
  if @options[:input_file]&.any?
63
65
  @options[:input_file].each do |file_path|
64
66
  begin
67
+ file_path = file_path[0] == "/" ? file_path : "#{current_directory}/#{file_path}"
65
68
  content = File.read(file_path).strip
66
69
  file_contents << "**File**: #{file_path}**\n#{content}"
67
70
  rescue => e
data/lib/myask/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Myask
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- myask (1.0.0)
4
+ myask (1.1.0)
5
5
  gli (~> 2.22.2)
6
6
 
7
7
  GEM
@@ -59,9 +59,12 @@ module MyAsk
59
59
  def get_initial_question
60
60
  file_contents = []
61
61
 
62
+ current_directory = Dir.pwd
63
+
62
64
  if @options[:input_file]&.any?
63
65
  @options[:input_file].each do |file_path|
64
66
  begin
67
+ file_path = file_path[0] == "/" ? file_path : "#{current_directory}/#{file_path}"
65
68
  content = File.read(file_path).strip
66
69
  file_contents << "**File**: #{file_path}**\n#{content}"
67
70
  rescue => e
@@ -1,3 +1,3 @@
1
1
  module Myask
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ gem "json", "~> 2.10"
5
+
6
+ gem "open-uri", "~> 0.5.0"
7
+ gem "tty-spinner", "~> 0.9.3"
8
+ gem "tty-prompt", "~> 0.23.1"
9
+
10
+ gem "pry-byebug", "~> 3.11"
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ myask (1.1.0)
5
+ gli (~> 2.22.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ byebug (12.0.0)
11
+ coderay (1.1.3)
12
+ date (3.4.1)
13
+ gli (2.22.2)
14
+ ostruct
15
+ json (2.10.2)
16
+ method_source (1.1.0)
17
+ minitest (5.25.5)
18
+ open-uri (0.5.0)
19
+ stringio
20
+ time
21
+ uri
22
+ ostruct (0.6.1)
23
+ pastel (0.8.0)
24
+ tty-color (~> 0.5)
25
+ pry (0.15.2)
26
+ coderay (~> 1.1)
27
+ method_source (~> 1.0)
28
+ pry-byebug (3.11.0)
29
+ byebug (~> 12.0)
30
+ pry (>= 0.13, < 0.16)
31
+ psych (5.2.3)
32
+ date
33
+ stringio
34
+ rake (13.2.1)
35
+ rdoc (6.13.0)
36
+ psych (>= 4.0.0)
37
+ stringio (3.1.6)
38
+ time (0.4.1)
39
+ date
40
+ tty-color (0.6.0)
41
+ tty-cursor (0.7.1)
42
+ tty-prompt (0.23.1)
43
+ pastel (~> 0.8)
44
+ tty-reader (~> 0.8)
45
+ tty-reader (0.9.0)
46
+ tty-cursor (~> 0.7)
47
+ tty-screen (~> 0.8)
48
+ wisper (~> 2.0)
49
+ tty-screen (0.8.2)
50
+ tty-spinner (0.9.3)
51
+ tty-cursor (~> 0.7)
52
+ uri (1.0.3)
53
+ wisper (2.0.1)
54
+
55
+ PLATFORMS
56
+ arm64-darwin-22
57
+
58
+ DEPENDENCIES
59
+ json (~> 2.10)
60
+ minitest
61
+ myask!
62
+ open-uri (~> 0.5.0)
63
+ pry-byebug (~> 3.11)
64
+ rake
65
+ rdoc
66
+ tty-prompt (~> 0.23.1)
67
+ tty-spinner (~> 0.9.3)
68
+
69
+ BUNDLED WITH
70
+ 2.4.22
@@ -0,0 +1,6 @@
1
+ = myask
2
+
3
+ Describe your project here
4
+
5
+ :include:myask.rdoc
6
+
@@ -0,0 +1,21 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ Rake::RDocTask.new do |rd|
6
+ rd.main = "README.rdoc"
7
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
8
+ rd.title = 'Your application title'
9
+ end
10
+
11
+ spec = Gem::Specification.load("myask.gemspec")
12
+
13
+ Gem::PackageTask.new(spec) do |pkg|
14
+ end
15
+ require 'rake/testtask'
16
+ Rake::TestTask.new do |t|
17
+ t.libs << "test"
18
+ t.test_files = FileList['test/*_test.rb']
19
+ end
20
+
21
+ task :default => :test
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env ruby
2
+ require "gli"
3
+ require "myask"
4
+
5
+ class App
6
+ extend GLI::App
7
+
8
+ config_file ".myask.rc"
9
+
10
+ program_desc "Describe your application here"
11
+
12
+ version Myask::VERSION
13
+
14
+ subcommand_option_handling :normal
15
+ arguments :strict
16
+
17
+ desc "Silent Progress Spinner"
18
+ default_value false
19
+ switch [:silent]
20
+
21
+ desc "Format Output as JSON"
22
+ default_value false
23
+ switch [:json]
24
+
25
+ desc "Host for MyAsk API"
26
+ default_value "https://myask.io"
27
+ flag [:api_host], type: String
28
+
29
+ desc "API Key for MyAsk API"
30
+ flag [:api_key], type: String
31
+
32
+ desc "Current MyAsk Project"
33
+ flag [:project], type: String
34
+
35
+ desc "View current or set new MyAsk configuration values"
36
+ command :config do |c|
37
+ MyAsk::Config.new(c)
38
+ end
39
+
40
+ desc "Send a prompt to MyAsk API"
41
+ command :prompt do |c|
42
+ MyAsk::Prompt.new(c)
43
+ end
44
+
45
+ desc "Create/show/list/delete MyAsk Project"
46
+ command :project do |c|
47
+ MyAsk::Api::Project.new(c)
48
+ end
49
+
50
+ desc "Show/delete MyAsk Question"
51
+ command :question do |c|
52
+ MyAsk::Api::Question.new(c)
53
+ end
54
+
55
+ desc "Create/list MyAsk Invitations"
56
+ command :invitation do |c|
57
+ MyAsk::Api::Invitation.new(c)
58
+ end
59
+
60
+ pre do |global,command,options,args|
61
+ unless command&.parent&.name == :config
62
+ config = global
63
+ auth_token = config[:api_key]
64
+ project = options[:project] || config[:project]
65
+
66
+ if auth_token.nil?
67
+ puts "Missing MyAsk API token. Set it using \"myask config -k YOUR_AUTH_TOKEN\"."
68
+ exit
69
+ end
70
+
71
+ if project.nil?
72
+ puts "MyAsk Project Not Set. Set it using \"myask api:project:set\"."
73
+ exit
74
+ end
75
+ end
76
+ true # false to break command
77
+ end
78
+
79
+ post do |global,command,options,args|
80
+ # Post logic here
81
+ # Use skips_post before a command to skip this
82
+ # block on that command only
83
+ end
84
+
85
+ on_error do |exception|
86
+ case exception
87
+ when TTY::Reader::InputInterrupt
88
+ abort "\n\n--- User Exit ---\n"
89
+ when SystemExit
90
+ # abort "Exited"
91
+ when Errno::ECONNREFUSED
92
+ abort "API Error: #{exception}"
93
+ else # RuntimeError
94
+ puts exception.backtrace
95
+ # binding.pry
96
+ end
97
+ false # false to skip default error handling
98
+ end
99
+ end
100
+
101
+ exit App.run(ARGV)
@@ -0,0 +1,116 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+
8
+ <title>class App - Your application title</title>
9
+
10
+ <meta name="keywords" content="ruby,class,App">
11
+
12
+ <meta name="description" content="Documentation for the App class">
13
+
14
+ <script type="text/javascript">
15
+ var rdoc_rel_prefix = "./";
16
+ var index_rel_prefix = "./";
17
+ </script>
18
+
19
+ <script src="./js/navigation.js" defer></script>
20
+ <script src="./js/search.js" defer></script>
21
+ <script src="./js/search_index.js" defer></script>
22
+ <script src="./js/searcher.js" defer></script>
23
+ <script src="./js/darkfish.js" defer></script>
24
+
25
+ <link href="./css/fonts.css" rel="stylesheet">
26
+ <link href="./css/rdoc.css" rel="stylesheet">
27
+
28
+
29
+ <body id="top" role="document" class="class">
30
+ <div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
31
+ <span aria-hidden="true">&#9776;</span>
32
+ </div>
33
+
34
+
35
+ <nav id="navigation" role="navigation">
36
+ <div id="project-navigation">
37
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
38
+ <h2>
39
+ <a href="./index.html" rel="home">Home</a>
40
+ </h2>
41
+
42
+ <div id="table-of-contents-navigation">
43
+ <a href="./table_of_contents.html#pages">Pages</a>
44
+ <a href="./table_of_contents.html#classes">Classes</a>
45
+ <a href="./table_of_contents.html#methods">Methods</a>
46
+ </div>
47
+ </div>
48
+
49
+ <div id="search-section" role="search" class="project-section initially-hidden">
50
+ <form action="#" method="get" accept-charset="utf-8">
51
+ <div id="search-field-wrapper">
52
+ <input id="search-field" role="combobox" aria-label="Search"
53
+ aria-autocomplete="list" aria-controls="search-results"
54
+ type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
55
+ title="Type to search, Up and Down to navigate, Enter to load">
56
+ </div>
57
+
58
+ <ul id="search-results" aria-label="Search Results"
59
+ aria-busy="false" aria-expanded="false"
60
+ aria-atomic="false" class="initially-hidden"></ul>
61
+ </form>
62
+ </div>
63
+
64
+ </div>
65
+
66
+
67
+
68
+ <div id="parent-class-section" class="nav-section">
69
+ <h3>Ancestors</h3>
70
+ <ul><li>Object</li></ul>
71
+ </div>
72
+
73
+
74
+
75
+ <div id="extends-section" class="nav-section">
76
+ <h3>Extended With Modules</h3>
77
+
78
+ <ul class="link-list">
79
+ <li><span class="extend">GLI::App</span>
80
+ </ul>
81
+ </div>
82
+
83
+
84
+
85
+
86
+
87
+
88
+ <footer id="validator-badges" role="contentinfo">
89
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
90
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.13.0.
91
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
92
+ </footer>
93
+
94
+ </nav>
95
+
96
+ <main role="main" aria-labelledby="class-App">
97
+
98
+
99
+
100
+ <h1 id="class-App" class="anchor-link class">
101
+ class App
102
+ </h1>
103
+
104
+ <section class="description">
105
+
106
+ </section>
107
+
108
+ <section id="5Buntitled-5D" class="documentation-section anchor-link">
109
+
110
+
111
+
112
+
113
+
114
+ </section>
115
+ </main>
116
+
@@ -0,0 +1,207 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+
8
+ <title>class MyAsk::Api::Helper - Your application title</title>
9
+
10
+ <meta name="keywords" content="ruby,class,MyAsk::Api::Helper">
11
+
12
+ <meta name="description" content="Documentation for the MyAsk::Api::Helper class">
13
+
14
+ <script type="text/javascript">
15
+ var rdoc_rel_prefix = "../../";
16
+ var index_rel_prefix = "../../";
17
+ </script>
18
+
19
+ <script src="../../js/navigation.js" defer></script>
20
+ <script src="../../js/search.js" defer></script>
21
+ <script src="../../js/search_index.js" defer></script>
22
+ <script src="../../js/searcher.js" defer></script>
23
+ <script src="../../js/darkfish.js" defer></script>
24
+
25
+ <link href="../../css/fonts.css" rel="stylesheet">
26
+ <link href="../../css/rdoc.css" rel="stylesheet">
27
+
28
+
29
+ <body id="top" role="document" class="class">
30
+ <div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
31
+ <span aria-hidden="true">&#9776;</span>
32
+ </div>
33
+
34
+
35
+ <nav id="navigation" role="navigation">
36
+ <div id="project-navigation">
37
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
38
+ <h2>
39
+ <a href="../../index.html" rel="home">Home</a>
40
+ </h2>
41
+
42
+ <div id="table-of-contents-navigation">
43
+ <a href="../../table_of_contents.html#pages">Pages</a>
44
+ <a href="../../table_of_contents.html#classes">Classes</a>
45
+ <a href="../../table_of_contents.html#methods">Methods</a>
46
+ </div>
47
+ </div>
48
+
49
+ <div id="search-section" role="search" class="project-section initially-hidden">
50
+ <form action="#" method="get" accept-charset="utf-8">
51
+ <div id="search-field-wrapper">
52
+ <input id="search-field" role="combobox" aria-label="Search"
53
+ aria-autocomplete="list" aria-controls="search-results"
54
+ type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
55
+ title="Type to search, Up and Down to navigate, Enter to load">
56
+ </div>
57
+
58
+ <ul id="search-results" aria-label="Search Results"
59
+ aria-busy="false" aria-expanded="false"
60
+ aria-atomic="false" class="initially-hidden"></ul>
61
+ </form>
62
+ </div>
63
+
64
+ </div>
65
+
66
+
67
+
68
+ <div id="parent-class-section" class="nav-section">
69
+ <h3>Ancestors</h3>
70
+ <ul><li>Object</li></ul>
71
+ </div>
72
+
73
+
74
+
75
+
76
+ <div class="nav-section">
77
+ <h3>Class Methods</h3>
78
+ <ul class="link-list" role="directory">
79
+ <li ><a href="#method-c-make_request">make_request</a></li>
80
+ </ul>
81
+ </div>
82
+
83
+
84
+
85
+
86
+
87
+ <footer id="validator-badges" role="contentinfo">
88
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
89
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.13.0.
90
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
91
+ </footer>
92
+
93
+ </nav>
94
+
95
+ <main role="main" aria-labelledby="class-MyAsk::Api::Helper">
96
+
97
+
98
+ <ol role="navigation" aria-label="breadcrumb" class="breadcrumb">
99
+
100
+ <li>
101
+
102
+ <a href="../../MyAsk.html">MyAsk</a><span>::</span>
103
+
104
+ </li>
105
+
106
+ <li>
107
+
108
+ <a href="../../MyAsk/Api.html">Api</a><span>::</span>
109
+
110
+ </li>
111
+
112
+ <li>
113
+
114
+ <span>Helper</span>
115
+
116
+ </li>
117
+
118
+ </ol>
119
+
120
+
121
+ <h1 id="class-MyAsk::Api::Helper" class="anchor-link class">
122
+ class MyAsk::Api::Helper
123
+ </h1>
124
+
125
+ <section class="description">
126
+
127
+ </section>
128
+
129
+ <section id="5Buntitled-5D" class="documentation-section anchor-link">
130
+
131
+
132
+
133
+
134
+
135
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section anchor-link">
136
+ <header>
137
+ <h3>Public Class Methods</h3>
138
+ </header>
139
+
140
+ <div id="method-c-make_request" class="method-detail anchor-link ">
141
+ <div class="method-header">
142
+ <div class="method-heading">
143
+ <a href="#method-c-make_request" title="Link to this method">
144
+ <span class="method-name">make_request</span>
145
+ <span class="method-args">(method, uri, api_key, payload = nil)</span>
146
+ </a>
147
+ </div>
148
+ </div>
149
+
150
+ <div class="method-controls">
151
+ <details class="method-source-toggle">
152
+ <summary>Source</summary>
153
+ </details>
154
+ </div>
155
+
156
+ <div class="method-description">
157
+ <div class="method-source-code" id="make_request-source">
158
+ <pre><span class="ruby-comment"># File lib/myask/api/api_helper.rb, line 5</span>
159
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">make_request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">api_key</span>, <span class="ruby-identifier">payload</span> = <span class="ruby-keyword">nil</span>)
160
+ <span class="ruby-identifier">http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>)
161
+ <span class="ruby-identifier">http</span>.<span class="ruby-identifier">use_ssl</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;https&#39;</span>
162
+
163
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;Get&quot;</span>
164
+ <span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Get</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">request_uri</span>)
165
+ <span class="ruby-identifier">request</span>[<span class="ruby-string">&#39;Authorization&#39;</span>] = <span class="ruby-node">&quot;Bearer #{api_key}&quot;</span>
166
+ <span class="ruby-identifier">request</span>[<span class="ruby-string">&quot;Content-Type&quot;</span>] = <span class="ruby-string">&quot;application/json&quot;</span>
167
+ <span class="ruby-identifier">response</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>)
168
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">method</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;Delete&quot;</span>
169
+ <span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Delete</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">request_uri</span>)
170
+ <span class="ruby-identifier">request</span>[<span class="ruby-string">&#39;Authorization&#39;</span>] = <span class="ruby-node">&quot;Bearer #{api_key}&quot;</span>
171
+ <span class="ruby-identifier">request</span>[<span class="ruby-string">&quot;Content-Type&quot;</span>] = <span class="ruby-string">&quot;application/json&quot;</span>
172
+ <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">payload</span>.<span class="ruby-identifier">to_json</span>
173
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">hostname</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>, <span class="ruby-value">use_ssl:</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;https&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
174
+ <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>)
175
+ <span class="ruby-keyword">end</span>
176
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">method</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;Patch&quot;</span>
177
+ <span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Patch</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">request_uri</span>)
178
+ <span class="ruby-identifier">request</span>[<span class="ruby-string">&#39;Authorization&#39;</span>] = <span class="ruby-node">&quot;Bearer #{api_key}&quot;</span>
179
+ <span class="ruby-identifier">request</span>[<span class="ruby-string">&quot;Content-Type&quot;</span>] = <span class="ruby-string">&quot;application/json&quot;</span>
180
+ <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">payload</span>.<span class="ruby-identifier">to_json</span>
181
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">hostname</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>, <span class="ruby-value">use_ssl:</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;https&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
182
+ <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>)
183
+ <span class="ruby-keyword">end</span>
184
+ <span class="ruby-keyword">else</span>
185
+ <span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">request_uri</span>)
186
+ <span class="ruby-identifier">request</span>[<span class="ruby-string">&#39;Authorization&#39;</span>] = <span class="ruby-node">&quot;Bearer #{api_key}&quot;</span>
187
+ <span class="ruby-identifier">request</span>[<span class="ruby-string">&quot;Content-Type&quot;</span>] = <span class="ruby-string">&quot;application/json&quot;</span>
188
+ <span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">payload</span>.<span class="ruby-identifier">to_json</span>
189
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">hostname</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>, <span class="ruby-value">use_ssl:</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;https&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
190
+ <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>)
191
+ <span class="ruby-keyword">end</span>
192
+ <span class="ruby-keyword">end</span>
193
+
194
+ <span class="ruby-identifier">response</span>
195
+ <span class="ruby-keyword">end</span></pre>
196
+ </div>
197
+
198
+ </div>
199
+
200
+
201
+ </div>
202
+
203
+ </section>
204
+
205
+ </section>
206
+ </main>
207
+