HubSpot-ruby Custom Objects sample app
December 12, 2022 ยท View on GitHub
Requirements
- ruby 3.1.3
- Configured .env file
Running
- Install dependencies
bundle install
- Commands
Show all commands (get help)
ruby cli.rb -h
Get all schemas
ruby cli.rb -a schema -m get_all
Get schema by id
ruby cli.rb -a schema -m get_by_id -t [schema_id]
Schema id will look like ****_name_of_your_schema. Please, check "fully_qualified_name" after creation.
Create schema
ruby cli.rb -a schema -m create -p [params]
Params is a json with schema params. Example:
ruby cli.rb -a schema -m create -p '{
"labels": {
"singular": "My object",
"plural": "My objects"
},
"required_properties": [
"my_object_property"
],
"properties": [
{
"name": "my_object_property",
"label": "My object property",
"isPrimaryDisplayLabel": true
}
],
"associated_objects": [
"CONTACT"
],
"name": "my_object",
"primaryDisplayProperty": "my_object_property"
}'
Update schema
ruby cli.rb -a schema -m update -t [schema_id] -p [params]
Example
ruby cli.rb -a schema -m update -t your_schema_id -p '{
"labels": {
"singular": "My updated object",
"plural": "My updated objects"
}
}'
Delete schema
ruby cli.rb -a schema -m archive -t [schema_id]
Get objects
ruby cli.rb -a object -m get_page -t [schema_id]
Get an object by id
ruby cli.rb -a object -m get_by_id -t [schema_id] -i [object_id]
Create new object
ruby cli.rb -a object -m create -t [schema_id] -p [params]
Params is a json, example:
'{"my_object_property":"my_object_value"}'
Update an object
ruby cli.rb -a object -m update -t [schema_id] -i [object_id] -p [params]
Params is a json, example:
'{"my_object_property":"my_updated_value"}'
Delete an object
ruby cli.rb -a object -m archive -t [schema_id] -i [object_id]