jsontodb 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -51
- data/lib/jsontodb/cli.rb +9 -1
- data/lib/jsontodb/processor.rb +2 -1
- data/lib/jsontodb/rest.rb +2 -2
- data/lib/jsontodb/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd549529c298d30d2576356007ff30ce0458b27f
|
4
|
+
data.tar.gz: bd950cd4f5e84244b8c4199377da7a1afa6fff66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 393f53bcbb668e4900ceebfe2edce46ecf02b12f8536192201d1907a9c1ef250676aa3317e8ef0acd9060e5d6570bfba05daa76d6fe68f400681522152f6af44
|
7
|
+
data.tar.gz: 1dbbe059e559573e038707fad60fd5a2c52781307fb6b8eb1d59a197dcec0af66bf71210651e194fca99401980210fc8d2fa272bd2201c5d3e1de478a4b8e74f
|
data/README.md
CHANGED
@@ -16,57 +16,7 @@ gem 'jsontodb'
|
|
16
16
|
```
|
17
17
|
|
18
18
|
## Usage
|
19
|
-
|
20
|
-
```sh
|
21
|
-
$ jsontodb
|
22
|
-
```
|
23
|
-
This command will open an interactive shell for **JSONtoDB** after prompting for authentication credentials (see [Authentication](#authentication)).
|
24
|
-
|
25
|
-
You can also pass your authentication credentials to the command then open an interactive shell:
|
26
|
-
```sh
|
27
|
-
$ jsontodb [username] [password]
|
28
|
-
```
|
29
|
-
|
30
|
-
Running a full **JSONtoDB** command is possible directly from the command-line as well:
|
31
|
-
```sh
|
32
|
-
$ jsontodb [username] [password] [command]
|
33
|
-
```
|
34
|
-
|
35
|
-
Functionality is planned for placing credentials in a file to avoid passwords being visible, as they are when passed to the `jsontodb` command (though
|
36
|
-
they are hidden in the interactive shell).
|
37
|
-
|
38
|
-
## Commands
|
39
|
-
Four commands are provided by default, and they represent their respective HTTP method:
|
40
|
-
|
41
|
-
### Get
|
42
|
-
Get represents the GET HTTP method, and its only parameter is the URL to GET:
|
43
|
-
```sh
|
44
|
-
$ [parent command] get [url]
|
45
|
-
```
|
46
|
-
|
47
|
-
### Delete
|
48
|
-
Delete represents the DELETE HTTP method, and its only parameter is the URL to DELETE:
|
49
|
-
```sh
|
50
|
-
$ [parent command] delete [url]
|
51
|
-
```
|
52
|
-
|
53
|
-
### Put
|
54
|
-
Put represents the PUT HTTP method. Its first parameter is the URL to PUT to, and its second parameter is the source of the data (a file path, see [Source Files](#source-files)):
|
55
|
-
```sh
|
56
|
-
$ [parent command] put [url] [source file]
|
57
|
-
```
|
58
|
-
|
59
|
-
### Post
|
60
|
-
Post represents the POST HTTP method. Its first parameter is the URL to POST to, and its second parameter is the source of the data (a file path, see [Source Files](#source-files)):
|
61
|
-
```sh
|
62
|
-
$ [parent command] post [url] [source file]
|
63
|
-
```
|
64
|
-
|
65
|
-
## Source Files
|
66
|
-
The only source data type (or content type) that **JSONtoDB** currently supports is [JSON](http://www.json.org/), hence the name **JSONtoDB**.
|
67
|
-
|
68
|
-
## Authentication
|
69
|
-
**JSONtoDB** offers [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) functionality only at this time. If you are using the interactive shell mode, it will prompt for credentials. Otherwise, you can pass them in as the first two parameters to the `jsontodb` command.
|
19
|
+
*Coming soon!*
|
70
20
|
|
71
21
|
## Copyright
|
72
22
|
Copyright (c) 2016 Christopher Lutz. See [LICENSE.txt](LICENSE.txt) for details.
|
data/lib/jsontodb/cli.rb
CHANGED
@@ -6,7 +6,7 @@ module JSONtoDB
|
|
6
6
|
module CLI
|
7
7
|
module_function
|
8
8
|
|
9
|
-
|
9
|
+
attr_accessor :user, :pass
|
10
10
|
|
11
11
|
def authentication_credentials(user = nil, pass = nil)
|
12
12
|
if user.nil? || pass.nil?
|
@@ -25,6 +25,14 @@ module JSONtoDB
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def user
|
29
|
+
@user
|
30
|
+
end
|
31
|
+
|
32
|
+
def pass
|
33
|
+
@pass
|
34
|
+
end
|
35
|
+
|
28
36
|
def continuous_cli
|
29
37
|
print 'jsontodb> '
|
30
38
|
input = STDIN.gets.chomp
|
data/lib/jsontodb/processor.rb
CHANGED
data/lib/jsontodb/rest.rb
CHANGED
@@ -30,8 +30,8 @@ module JSONtoDB
|
|
30
30
|
def data_request(klass, url, src, user, pass)
|
31
31
|
if File.directory?(src)
|
32
32
|
|
33
|
-
Dir["#{src}/*.json"].each do |
|
34
|
-
file_request(klass, url,
|
33
|
+
Dir["#{src}/*.json"].each do |file|
|
34
|
+
file_request(klass, url, file, user, pass)
|
35
35
|
end
|
36
36
|
|
37
37
|
elsif File.file?(src)
|
data/lib/jsontodb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsontodb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Lutz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cogwheels
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.2'
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
- lutzblox@gmail.com
|