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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66c48cd9be308e1d08567869d61c5fb450a1251928dd9f013313096224b4735b
4
- data.tar.gz: 77ddd812edc3de3c23a1419e11179906c51f78ebe9ac3849f4401fd61d931436
3
+ metadata.gz: 04e91f2dee32fa32fbfc2907d12cd0489a6e9380ea0c7a93f61f3e27fe23be2f
4
+ data.tar.gz: f94417fd4bc69180c9eff4ec6cc38d82b74111ae4275cb5b1b04f1badccc4e44
5
5
  SHA512:
6
- metadata.gz: 9c3b456532eb9739f883f3299d69556259687df63c4b253b8caf3d0745aca6f7563eeaf29110e6c1660bb6ab7aaed8094362ae3af28c27cfd2e0f6b656e5e087
7
- data.tar.gz: a8e7bc04334a13d214e7d9f32bb0f8e6cc512632e1c96c14873c6c931030aac552a9ac5815b7df6755ca52edf4ed16785abc501972cae7f642854ec0fcf9c24a
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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
@@ -31,8 +31,8 @@ module Unstructured
31
31
  ChunkCollection.from_response handle_response(connection.post(
32
32
  "/general/v0/general",
33
33
  default_params.merge(params).merge({
34
- files: files(file_path)
35
- }),
34
+ files: files(file_path)
35
+ }),
36
36
  headers
37
37
  ))
38
38
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unstructured
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unstructured
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Fernando Davila