No commit activity in last 3 years
No release in over 3 years
Simple ruby wrapper for Tilda API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0
~> 3.0
~> 0.16
~> 3.4

Runtime

>= 0.10.0
 Project Readme

Tilda::Simple::Api

Gem Version Build Status Maintainability Test Coverage

Simple ruby wrapper for Tilda API

Installation

Add this line to your application's Gemfile:

gem 'tilda-simple-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tilda-simple-api

Usage

Configuration api:

  Tilda::Simple::Api.configure do |config|
    config.public_key = "your-public-key"
    config.secret_key = "your-secret-key"
    # config.api_version = "v1" # by default'
    # config.api_host = "http://api.tildacdn.info" # by default'
    # config.raise_api_errors = false # by_default
  end

API requests example

Init API request

  tilda_api = Tilda::Simple::Api::Request.new 
  # Or pass public_key and secret_key directly
  tilda_api = Tilda::Simple::Api::Request.new(public_key: "your-public-key", secret_key: "your-secret-key")

API calls

API Call name Usage Request/Response example
projects list tilda_api.projects_list http://help.tilda.ws/api#getprojectslist
project by project_id tilda_api.project(project_id) http://help.tilda.ws/api#getproject
project info for export tilda_api.project_export(project_id) http://help.tilda.ws/api#getprojectexport
pages list for project tilda_api.pages_list(project_id) http://help.tilda.ws/api#getpageslist
page by page_id(only body) tilda_api.page(page_id) http://help.tilda.ws/api#getpage
full page by page_id tilda_api.page_full(page_id) http://help.tilda.ws/api#getpagefull
page info for export(only body) tilda_api.page_export(page_id) http://help.tilda.ws/api#getpageexport
full page info for export tilda_api.page_full_export(page_id) http://help.tilda.ws/api#getpagefullexport

API Errors

When switch config.raise_api_errors to true. API raise errors. Here is available API Errors:

API Error Error case
Tilda::Simple::Api::Errors::InvalidCredentials invalid public_key or secret_key passed
Tilda::Simple::Api::Errors::ProjectNotFound tilda api not found project by passed project_id
Tilda::Simple::Api::Errors::PageNotFound tilda api not found page by passed page_id
Tilda::Simple::Api::Errors::Error in all other cases

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tilda-simple-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Tilda::Simple::Api project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.