Browse our Products

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.


Docs Swagger Examples Blog Support Dashboard

Installation

The package is available at rubygems.org and it can be installed via gem by executing the following command:

gem install groupdocs_metadata_cloud

Gem Version Gem Total Downloads Ruby-GroupDocsCloud


Requirements

Dependencies

The SDK requires the following gems:

PackageConstraint
addressable~> 2.8.0, >= 2.8.0
faraday~> 0.14.0

Quick Start

Get your API credentials

To use GroupDocs.Metadata Cloud, sign up at GroupDocs.Cloud Dashboard and get your Client ID and Client Secret.

Initialize the API

Use the following code to start using the GroupDocs.Metadata Cloud SDK for Ruby. The constructor takes the Client ID, then the Client Secret.

require 'groupdocs_metadata_cloud'

# Get your APP_SID and APP_KEY at https://dashboard.groupdocs.cloud
client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsMetadataCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

metadata_api = GroupDocsMetadataCloud::MetadataApi.from_config(config)

See test_context.rb for more details.

Extract metadata

Once initialized, use this basic example to extract the metadata tree from a Word document in cloud storage.

require 'groupdocs_metadata_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsMetadataCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

metadata_api = GroupDocsMetadataCloud::MetadataApi.from_config(config)

options = GroupDocsMetadataCloud::ExtractOptions.new
options.file_info = GroupDocsMetadataCloud::FileInfo.new
options.file_info.file_path = "documents/input.docx"
request = GroupDocsMetadataCloud::ExtractRequest.new(options)

response = metadata_api.extract(request)
puts(response.metadata_tree.inner_packages.length.to_s)

See test_metadata_extract_api.rb for more details.

Set a Metadata Property

This example replaces the Creator property on a Word document.

require 'groupdocs_metadata_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsMetadataCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

metadata_api = GroupDocsMetadataCloud::MetadataApi.from_config(config)

options = GroupDocsMetadataCloud::SetOptions.new
options.file_info = GroupDocsMetadataCloud::FileInfo.new
options.file_info.file_path = "documents/input.docx"

exact_tag = GroupDocsMetadataCloud::Tag.new
exact_tag.name = "Creator"
exact_tag.category = "Person"
tag_options = GroupDocsMetadataCloud::TagOptions.new
tag_options.exact_tag = exact_tag
search_criteria = GroupDocsMetadataCloud::SearchCriteriaWithoutValue.new
search_criteria.tag_options = tag_options
set_property = GroupDocsMetadataCloud::SetProperty.new
set_property.new_value = "NewAuthor"
set_property.type = "String"
set_property.search_criteria = search_criteria

options.properties = [set_property]
request = GroupDocsMetadataCloud::SetRequest.new(options)

response = metadata_api.set(request)
puts(response.set_count.to_s)

See test_metadata_set_api.rb for more details.

Remove Metadata by Tag

This example removes the Title property from a Word document.

require 'groupdocs_metadata_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsMetadataCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

metadata_api = GroupDocsMetadataCloud::MetadataApi.from_config(config)

options = GroupDocsMetadataCloud::RemoveOptions.new
options.file_info = GroupDocsMetadataCloud::FileInfo.new
options.file_info.file_path = "documents/input.docx"

exact_tag = GroupDocsMetadataCloud::Tag.new
exact_tag.name = "Title"
exact_tag.category = "Content"
tag_options = GroupDocsMetadataCloud::TagOptions.new
tag_options.exact_tag = exact_tag
search_criteria = GroupDocsMetadataCloud::SearchCriteria.new
search_criteria.tag_options = tag_options

options.search_criteria = search_criteria
request = GroupDocsMetadataCloud::RemoveRequest.new(options)

response = metadata_api.remove(request)
puts(response.removed_count.to_s)

See test_metadata_remove_api.rb for more details.

Get Document Information

This example reads the file format and page count of a presentation.

require 'groupdocs_metadata_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsMetadataCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

info_api = GroupDocsMetadataCloud::InfoApi.from_config(config)

options = GroupDocsMetadataCloud::InfoOptions.new
options.file_info = GroupDocsMetadataCloud::FileInfo.new
options.file_info.file_path = "documents/input.pptx"
request = GroupDocsMetadataCloud::GetInfoRequest.new(options)

response = info_api.get_info(request)
puts(response.page_count.to_s)

See test_metadata_info_api.rb for more details.

Get Supported Metadata Formats

Retrieve the file formats the API can read.

require 'groupdocs_metadata_cloud'

client_id = "YourClientId"
client_secret = "YourClientSecret"

config = GroupDocsMetadataCloud::Configuration.new(client_id, client_secret)
config.api_base_url = "https://api.groupdocs.cloud"

info_api = GroupDocsMetadataCloud::InfoApi.from_config(config)
response = info_api.get_supported_file_formats
response.formats.each do |format|
  puts(format.file_format)
end

See test_metadata_formats_api.rb for more details.

Examples on GitHub

The GroupDocs.Metadata Cloud Ruby SDK repository includes the SDK and tests covering:

CategoryExamples
MetadataExtract, add, set, and remove metadata; search by tag or property name
InfoDocument information and supported file formats
StorageFile, folder, and storage operations

How to run the examples

  1. Clone or download the SDK repository
  2. Edit test/test_settings.rb and set APP_SID and APP_KEY
  3. Run gem install groupdocs_metadata_cloud
  4. The tests are in test/api/

For more details, visit Getting Started.


Docs Swagger Examples Blog Support Dashboard


Tags

Document Metadata API | Ruby Cloud API | GroupDocs.Metadata Cloud | REST API | Metadata Extraction | Metadata Management | Metadata Filtering | Metadata Searching | Metadata Preservation | Cloud Storage Integration | File Management | Folder Management | File Versioning | Secure API Access | Cross-Platform API | PDF Metadata | Image Metadata | Video Metadata | Audio Metadata | Document Metadata Editing | MIT License



 English