unstructured 0.1.0 → 0.2.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 +8 -7
- data/lib/unstructured/client.rb +2 -2
- data/lib/unstructured/object.rb +7 -0
- data/lib/unstructured/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04e91f2dee32fa32fbfc2907d12cd0489a6e9380ea0c7a93f61f3e27fe23be2f
|
4
|
+
data.tar.gz: f94417fd4bc69180c9eff4ec6cc38d82b74111ae4275cb5b1b04f1badccc4e44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e603eb1ea45a348ff0b5c3edcc4ef54e1894906a74d3359a0fc41a039448ed49a73493054ced67488e9f1f543bca54833c31ad46cbb49ba8dd424a56637b0b23
|
7
|
+
data.tar.gz: 66c72aba06d0bc640aade82cdb8b02835818a08cc57fe95b071f36573031b7184c16cfb98518c27d19d6858912fead04201f9acc52f9a5e15e6c2c971f96f92f
|
data/README.md
CHANGED
@@ -3,17 +3,19 @@ This is a Ruby client for the [Unstructured API](https://unstructured-io.github.
|
|
3
3
|
|
4
4
|
## Installation
|
5
5
|
|
6
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
7
|
-
|
8
6
|
Install the gem and add to the application's Gemfile by executing:
|
9
|
-
|
10
|
-
$ bundle add
|
7
|
+
```
|
8
|
+
$ bundle add unstructured
|
9
|
+
```
|
11
10
|
|
12
11
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
13
|
-
|
14
|
-
$ gem install
|
12
|
+
```
|
13
|
+
$ gem install unstructured
|
14
|
+
```
|
15
15
|
|
16
16
|
## Usage
|
17
|
+
Find all available params on [Unstructured documentation](https://unstructured-io.github.io/unstructured/apis/api_parameters.html)
|
18
|
+
|
17
19
|
```ruby
|
18
20
|
server_url = "https://api.unstructured.io" # "http://localhost:8000" if you are running a docker container
|
19
21
|
client = Unstructured::Client.new(server_url: server_url, api_key: ENV["UNSTRUCTURED_API_KEY"])
|
@@ -28,7 +30,6 @@ params = {
|
|
28
30
|
new_after_n_chars: 1000
|
29
31
|
}
|
30
32
|
chunks = client.partition(file_path, params)
|
31
|
-
|
32
33
|
```
|
33
34
|
|
34
35
|
## Development
|
data/lib/unstructured/client.rb
CHANGED
data/lib/unstructured/object.rb
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
require "ostruct"
|
4
4
|
module Unstructured
|
5
5
|
class Object
|
6
|
+
attr_reader :attributes, :raw_data
|
7
|
+
|
6
8
|
def initialize(attributes)
|
9
|
+
@raw_data = attributes
|
7
10
|
@attributes = OpenStruct.new(attributes)
|
8
11
|
end
|
9
12
|
|
@@ -16,5 +19,9 @@ module Unstructured
|
|
16
19
|
def respond_to_missing?(_method, _include_private = false)
|
17
20
|
true
|
18
21
|
end
|
22
|
+
|
23
|
+
def to_h
|
24
|
+
@raw_data
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
data/lib/unstructured/version.rb
CHANGED