Skip to content

Commit 7b0e449

Browse files
New Version of Contentstack Ruby SDK
1 parent 8d81e51 commit 7b0e449

27 files changed

+1052
-351
lines changed

.gitignore

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
/.bundle/
2-
/.yardoc
3-
/Gemfile.lock
4-
/_yardoc/
5-
/coverage/
6-
/doc/
7-
/pkg/
8-
/lib/debugger.rb
9-
/spec/reports/
10-
/tmp/
11-
.env
1+
contentstack-*
2+
build_doc.sh
3+
test
4+
doc
5+
spec-integration
6+
coverage
7+
\.yardoc

.rspec

Lines changed: 0 additions & 2 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.yardopts

Lines changed: 0 additions & 4 deletions
This file was deleted.

Gemfile

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.rdoc

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
= Contentstack Ruby SDK
2+
3+
<i>Use Built.io Contentstack to power content for your Ruby projects</i>
4+
5+
Create Ruby based applications and use the Ruby SDK to fetch and deliver content from Built.io Contentstack. The SDK uses Content Delivery APIs.
6+
7+
== Getting Started
8+
9+
This guide will help you get started with our Ruby SDK to build apps powered by Built.io Contentstack.
10+
11+
=== SDK Installation and Setup
12+
13+
To use the Ruby SDK, download it using the gem install command
14+
15+
$ gem install contentstack
16+
17+
=== Initialize SDK
18+
19+
You will need to specify the API key, Access token, and Environment Name of your stack to initialize the SDK:
20+
21+
@stack = Contentstack::Client.new("site_api_key", "access_token", "enviroment_name")
22+
23+
Once you have initialized the SDK, you can start getting content in your app.
24+
25+
=== Basic Queries
26+
27+
==== Get a Single Entry
28+
29+
To get a single entry, you need to specify the content type as well as the uid of the entry.
30+
31+
entry = @stack.content_type('content_type_uid').entry("entry_uid").fetch
32+
puts entry.get('title') # Use `get` method to retrieve field value by providing a field's unique ID
33+
34+
==== Get Multiple Entries
35+
36+
To retrieve multiple entries of a content type, you need to specify the content type uid. You can also specify search parameters to filter results.
37+
38+
@query = @stack.content_type('blog').query
39+
@entries = @query.where('title', 'welcome')
40+
.include_schema
41+
.include_count
42+
.fetch
43+
44+
puts "Total Entries -- #{@entries.count}"
45+
@entries.each{|entry| puts "#{entry.get('title')}" }
46+
47+
48+
== API Reference
49+
50+
Go through our SDK API Reference guide to know about the methods that can be used to query your content in Built.io Contentstack.
51+
52+
{Read Ruby SDK API Reference Guide}[/docs/Contentstack]
53+
54+
55+
== Example Apps
56+
57+
To help you get started, we have created some sample applications that are powered by Built.io Contentstack Ruby SDK. Click on any of the links below to read the tutorials of the app, view app demo, or download the code from GitHub.
58+
59+
{Product Catalog}[#]
60+
61+
Built.io Contentstack provides Ruby SDK using which you can create applications based on Ruby, or any other web frameworks created using Ruby.

Rakefile

Lines changed: 0 additions & 6 deletions
This file was deleted.

bin/console

Lines changed: 0 additions & 14 deletions
This file was deleted.

bin/setup

Lines changed: 0 additions & 8 deletions
This file was deleted.

contentstack.gemspec

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,25 @@
1-
# coding: utf-8
21
lib = File.expand_path('../lib', __FILE__)
32
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4-
require 'contentstack/version'
53

6-
Gem::Specification.new do |spec|
7-
spec.name = "contentstack"
8-
spec.version = Contentstack::VERSION
9-
spec.authors = ["amite"]
10-
spec.email = ["amit.erandole@gmail.com"]
4+
require 'contentstack/version'
5+
Gem::Specification.new do |s|
6+
s.name = %q{contentstack}
7+
s.version = Contentstack::VERSION.dup
8+
s.date = Time.now
9+
s.authors = [%q{Rohit Sharma}]
10+
s.email = ["rubygems@contentstack.com"]
1111

12-
spec.summary = %q{A ruby gem to work with contentstack.built.io}
13-
spec.description = %q{A ruby gem to work with the Content Delivery API for contentstack.built.io}
14-
spec.homepage = ""
15-
spec.license = "MIT"
12+
s.license = "MIT"
1613

17-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18-
# to allow pushing to a single host or delete this section to allow pushing to any host.
19-
if spec.respond_to?(:metadata)
20-
spec.metadata['allowed_push_host'] = "http://rubygems.org"
21-
else
22-
raise "RubyGems 2.0 or newer is required to protect against " \
23-
"public gem pushes."
24-
end
14+
s.summary = %q{A ruby gem to work with Contentstack}
15+
s.description = %q{A ruby gem to work with the Content Delivery API for contentstack}
2516

26-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
27-
f.match(%r{^(test|spec|features)/})
28-
end
29-
spec.bindir = "exe"
30-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31-
spec.require_paths = ["lib"]
17+
s.files = `git ls-files`.split("\n")
18+
s.require_paths = ["lib"]
3219

33-
spec.add_dependency 'typhoeus', '~> 1.1', '>= 1.1.2'
34-
spec.add_dependency 'multi_json', '~> 1.12', '>= 1.12.1'
35-
spec.add_dependency 'activesupport'
20+
s.add_dependency 'activesupport', "> 3.2.5"
3621

37-
spec.add_development_dependency 'bundler', '~> 1.13', '>= 1.13.6'
38-
spec.add_development_dependency 'rake', '~> 12.0'
39-
spec.add_development_dependency 'rspec', '~> 3.5'
40-
spec.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.3'
41-
spec.add_development_dependency 'awesome_print'
42-
spec.add_development_dependency 'rb-readline'
43-
spec.add_development_dependency 'byebug'
44-
spec.add_development_dependency 'webmock', '~> 2.3', '>= 2.3.1'
45-
spec.add_development_dependency 'dotenv', '~> 2.1', '>= 2.1.1'
46-
spec.add_development_dependency 'yard'
47-
end
22+
s.add_development_dependency 'rspec'
23+
s.add_development_dependency 'webmock'
24+
s.add_development_dependency 'simplecov'
25+
end

0 commit comments

Comments
 (0)