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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/myask/prompt_helper.rb +3 -0
- data/lib/myask/version.rb +1 -1
- data/pkg/myask-0.0.1/Gemfile.lock +1 -1
- data/pkg/myask-0.0.1/lib/myask/prompt_helper.rb +3 -0
- data/pkg/myask-0.0.1/lib/myask/version.rb +1 -1
- data/pkg/myask-1.0.0/Gemfile +10 -0
- data/pkg/myask-1.0.0/Gemfile.lock +70 -0
- data/pkg/myask-1.0.0/README.rdoc +6 -0
- data/pkg/myask-1.0.0/Rakefile +21 -0
- data/pkg/myask-1.0.0/bin/myask +101 -0
- data/pkg/myask-1.0.0/html/App.html +116 -0
- data/pkg/myask-1.0.0/html/MyAsk/Api/Helper.html +207 -0
- data/pkg/myask-1.0.0/html/MyAsk/Api/Invitation.html +212 -0
- data/pkg/myask-1.0.0/html/MyAsk/Api/Project.html +355 -0
- data/pkg/myask-1.0.0/html/MyAsk/Api/ProjectHelper.html +299 -0
- data/pkg/myask-1.0.0/html/MyAsk/Api/Question.html +261 -0
- data/pkg/myask-1.0.0/html/MyAsk/Api.html +120 -0
- data/pkg/myask-1.0.0/html/MyAsk/Config.html +195 -0
- data/pkg/myask-1.0.0/html/MyAsk/ConfigHelper.html +251 -0
- data/pkg/myask-1.0.0/html/MyAsk/Prompt.html +221 -0
- data/pkg/myask-1.0.0/html/MyAsk/PromptHelper.html +330 -0
- data/pkg/myask-1.0.0/html/MyAsk.html +114 -0
- data/pkg/myask-1.0.0/html/README_rdoc.html +394 -0
- data/pkg/myask-1.0.0/html/created.rid +14 -0
- data/pkg/myask-1.0.0/html/css/fonts.css +167 -0
- data/pkg/myask-1.0.0/html/css/rdoc.css +681 -0
- data/pkg/myask-1.0.0/html/fonts/Lato-Light.ttf +0 -0
- data/pkg/myask-1.0.0/html/fonts/Lato-LightItalic.ttf +0 -0
- data/pkg/myask-1.0.0/html/fonts/Lato-Regular.ttf +0 -0
- data/pkg/myask-1.0.0/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/pkg/myask-1.0.0/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/pkg/myask-1.0.0/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/pkg/myask-1.0.0/html/images/add.png +0 -0
- data/pkg/myask-1.0.0/html/images/arrow_up.png +0 -0
- data/pkg/myask-1.0.0/html/images/brick.png +0 -0
- data/pkg/myask-1.0.0/html/images/brick_link.png +0 -0
- data/pkg/myask-1.0.0/html/images/bug.png +0 -0
- data/pkg/myask-1.0.0/html/images/bullet_black.png +0 -0
- data/pkg/myask-1.0.0/html/images/bullet_toggle_minus.png +0 -0
- data/pkg/myask-1.0.0/html/images/bullet_toggle_plus.png +0 -0
- data/pkg/myask-1.0.0/html/images/date.png +0 -0
- data/pkg/myask-1.0.0/html/images/delete.png +0 -0
- data/pkg/myask-1.0.0/html/images/find.png +0 -0
- data/pkg/myask-1.0.0/html/images/loadingAnimation.gif +0 -0
- data/pkg/myask-1.0.0/html/images/macFFBgHack.png +0 -0
- data/pkg/myask-1.0.0/html/images/package.png +0 -0
- data/pkg/myask-1.0.0/html/images/page_green.png +0 -0
- data/pkg/myask-1.0.0/html/images/page_white_text.png +0 -0
- data/pkg/myask-1.0.0/html/images/page_white_width.png +0 -0
- data/pkg/myask-1.0.0/html/images/plugin.png +0 -0
- data/pkg/myask-1.0.0/html/images/ruby.png +0 -0
- data/pkg/myask-1.0.0/html/images/tag_blue.png +0 -0
- data/pkg/myask-1.0.0/html/images/tag_green.png +0 -0
- data/pkg/myask-1.0.0/html/images/transparent.png +0 -0
- data/pkg/myask-1.0.0/html/images/wrench.png +0 -0
- data/pkg/myask-1.0.0/html/images/wrench_orange.png +0 -0
- data/pkg/myask-1.0.0/html/images/zoom.png +0 -0
- data/pkg/myask-1.0.0/html/index.html +403 -0
- data/pkg/myask-1.0.0/html/js/darkfish.js +120 -0
- data/pkg/myask-1.0.0/html/js/navigation.js +105 -0
- data/pkg/myask-1.0.0/html/js/navigation.js.gz +0 -0
- data/pkg/myask-1.0.0/html/js/search.js +110 -0
- data/pkg/myask-1.0.0/html/js/search_index.js +1 -0
- data/pkg/myask-1.0.0/html/js/search_index.js.gz +0 -0
- data/pkg/myask-1.0.0/html/js/searcher.js +229 -0
- data/pkg/myask-1.0.0/html/js/searcher.js.gz +0 -0
- data/pkg/myask-1.0.0/html/table_of_contents.html +257 -0
- data/pkg/myask-1.0.0/lib/myask/api/api_helper.rb +45 -0
- data/pkg/myask-1.0.0/lib/myask/api/invitation.rb +49 -0
- data/pkg/myask-1.0.0/lib/myask/api/project.rb +193 -0
- data/pkg/myask-1.0.0/lib/myask/api/project_helper.rb +46 -0
- data/pkg/myask-1.0.0/lib/myask/api/question.rb +99 -0
- data/pkg/myask-1.0.0/lib/myask/config.rb +37 -0
- data/pkg/myask-1.0.0/lib/myask/config_helper.rb +28 -0
- data/pkg/myask-1.0.0/lib/myask/prompt.rb +63 -0
- data/pkg/myask-1.0.0/lib/myask/prompt_helper.rb +83 -0
- data/pkg/myask-1.0.0/lib/myask/version.rb +3 -0
- data/pkg/myask-1.0.0/lib/myask.rb +28 -0
- data/pkg/myask-1.0.0/myask.gemspec +22 -0
- data/pkg/myask-1.0.0/myask.rdoc +138 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/Gemfile +10 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/Gemfile.lock +70 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/README.rdoc +6 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/Rakefile +21 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/bin/myask +101 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/api_helper.rb +45 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/invitation.rb +49 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/project.rb +193 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/project_helper.rb +46 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/api/question.rb +99 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/config.rb +37 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/config_helper.rb +28 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/prompt.rb +63 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/prompt_helper.rb +83 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask/version.rb +3 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/lib/myask.rb +28 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/myask.gemspec +22 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/myask.rdoc +138 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/test/default_test.rb +14 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1/test/test_helper.rb +4 -0
- data/pkg/myask-1.0.0/pkg/myask-0.0.1.gem +0 -0
- data/pkg/myask-1.0.0/test/default_test.rb +14 -0
- data/pkg/myask-1.0.0/test/test_helper.rb +4 -0
- data/pkg/myask-1.0.0.gem +0 -0
- metadata +101 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff4726b6be34b825c282f02dda2cffb42ed8dd7736cf676a1a058f554cb4ee57
|
4
|
+
data.tar.gz: 97b39f56842b0bec07a706a95716822cbaa74369ce946dbdaa567ae0a2f3a818
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba02d462a19e6140d552c9dfedabcf934ae05f36b1970875820590a8aa591b33820842cbc603ae5699ae5aaac9b31f6ff14e65c64301df00e75805c6c5b04e6
|
7
|
+
data.tar.gz: 680957caf1bbfc201b8402af8af8eed10237ca451f327c7ad89bb6cfe0744a7fb662ff2cbd58a85e652ed848ea26c14cc22e1c567873ac09985d17e1e1820ba4
|
data/Gemfile.lock
CHANGED
data/lib/myask/prompt_helper.rb
CHANGED
@@ -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
@@ -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
|
@@ -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,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">☰</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">☰</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">'https'</span>
|
162
|
+
|
163
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span> <span class="ruby-operator">==</span> <span class="ruby-string">"Get"</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">'Authorization'</span>] = <span class="ruby-node">"Bearer #{api_key}"</span>
|
166
|
+
<span class="ruby-identifier">request</span>[<span class="ruby-string">"Content-Type"</span>] = <span class="ruby-string">"application/json"</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">"Delete"</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">'Authorization'</span>] = <span class="ruby-node">"Bearer #{api_key}"</span>
|
171
|
+
<span class="ruby-identifier">request</span>[<span class="ruby-string">"Content-Type"</span>] = <span class="ruby-string">"application/json"</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">'https'</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">"Patch"</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">'Authorization'</span>] = <span class="ruby-node">"Bearer #{api_key}"</span>
|
179
|
+
<span class="ruby-identifier">request</span>[<span class="ruby-string">"Content-Type"</span>] = <span class="ruby-string">"application/json"</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">'https'</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">'Authorization'</span>] = <span class="ruby-node">"Bearer #{api_key}"</span>
|
187
|
+
<span class="ruby-identifier">request</span>[<span class="ruby-string">"Content-Type"</span>] = <span class="ruby-string">"application/json"</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">'https'</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
|
+
|