contentstack 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.yardopts +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/LICENSE.txt +21 -0
- data/README.rdoc +61 -0
- data/contentstack.gemspec +26 -0
- data/lib/contentstack.rb +20 -0
- data/lib/contentstack/api.rb +54 -0
- data/lib/contentstack/asset.rb +67 -0
- data/lib/contentstack/asset_collection.rb +26 -0
- data/lib/contentstack/client.rb +29 -0
- data/lib/contentstack/content_type.rb +52 -0
- data/lib/contentstack/entry.rb +27 -0
- data/lib/contentstack/entry_collection.rb +43 -0
- data/lib/contentstack/error.rb +7 -0
- data/lib/contentstack/query.rb +589 -0
- data/lib/contentstack/version.rb +3 -0
- data/lib/util.rb +107 -0
- data/rakefile.rb +4 -0
- data/spec/asset_collection_spec.rb +16 -0
- data/spec/asset_spec.rb +48 -0
- data/spec/content_type_spec.rb +64 -0
- data/spec/contentstack_spec.rb +10 -0
- data/spec/entry_collection_spec.rb +42 -0
- data/spec/entry_spec.rb +23 -0
- data/spec/fixtures/asset.json +1 -0
- data/spec/fixtures/asset_collection.json +1 -0
- data/spec/fixtures/category_entry.json +1 -0
- data/spec/fixtures/category_entry_collection.json +1 -0
- data/spec/fixtures/category_entry_collection_without_count.json +1 -0
- data/spec/fixtures/content_types.json +1 -0
- data/spec/fixtures/product_entry.json +1 -0
- data/spec/fixtures/product_entry_collection.json +1 -0
- data/spec/query_spec.rb +188 -0
- data/spec/spec_helper.rb +146 -0
- metadata +163 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
require 'webmock/rspec'
|
17
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|
18
|
+
|
19
|
+
require 'simplecov'
|
20
|
+
SimpleCov.start
|
21
|
+
|
22
|
+
require 'contentstack'
|
23
|
+
|
24
|
+
RSpec.configure do |config|
|
25
|
+
# rspec-expectations config goes here. You can use an alternate
|
26
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
27
|
+
# assertions if you prefer.
|
28
|
+
config.expect_with :rspec do |expectations|
|
29
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
30
|
+
# and `failure_message` of custom matchers include text for helper methods
|
31
|
+
# defined using `chain`, e.g.:
|
32
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
33
|
+
# # => "be bigger than 2 and smaller than 4"
|
34
|
+
# ...rather than:
|
35
|
+
# # => "be bigger than 2"
|
36
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
37
|
+
end
|
38
|
+
|
39
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
40
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
41
|
+
config.mock_with :rspec do |mocks|
|
42
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
43
|
+
# a real object. This is generally recommended, and will default to
|
44
|
+
# `true` in RSpec 4.
|
45
|
+
mocks.verify_partial_doubles = true
|
46
|
+
end
|
47
|
+
|
48
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
49
|
+
# have no way to turn it off -- the option exists only for backwards
|
50
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
51
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
52
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
53
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
54
|
+
|
55
|
+
# The settings below are suggested to provide a good initial experience
|
56
|
+
# with RSpec, but feel free to customize to your heart's content.
|
57
|
+
=begin
|
58
|
+
# This allows you to limit a spec run to individual examples or groups
|
59
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
60
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
61
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
62
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
63
|
+
config.filter_run_when_matching :focus
|
64
|
+
|
65
|
+
# Allows RSpec to persist some state between runs in order to support
|
66
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
67
|
+
# you configure your source control system to ignore this file.
|
68
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
69
|
+
|
70
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
71
|
+
# recommended. For more details, see:
|
72
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
73
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
74
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
75
|
+
config.disable_monkey_patching!
|
76
|
+
|
77
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
78
|
+
# be too noisy due to issues in dependencies.
|
79
|
+
config.warnings = true
|
80
|
+
|
81
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
82
|
+
# file, and it's useful to allow more verbose output when running an
|
83
|
+
# individual spec file.
|
84
|
+
if config.files_to_run.one?
|
85
|
+
# Use the documentation formatter for detailed output,
|
86
|
+
# unless a formatter has already been configured
|
87
|
+
# (e.g. via a command-line flag).
|
88
|
+
config.default_formatter = "doc"
|
89
|
+
end
|
90
|
+
|
91
|
+
# Print the 10 slowest examples and example groups at the
|
92
|
+
# end of the spec run, to help surface which specs are running
|
93
|
+
# particularly slow.
|
94
|
+
config.profile_examples = 10
|
95
|
+
|
96
|
+
# Run specs in random order to surface order dependencies. If you find an
|
97
|
+
# order dependency and want to debug it, you can fix the order by providing
|
98
|
+
# the seed, which is printed after each run.
|
99
|
+
# --seed 1234
|
100
|
+
config.order = :random
|
101
|
+
|
102
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
103
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
104
|
+
# test failures related to randomization by passing the same `--seed` value
|
105
|
+
# as the one that triggered the failure.
|
106
|
+
Kernel.srand config.seed
|
107
|
+
=end
|
108
|
+
|
109
|
+
config.before(:each) do
|
110
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/content_types/).
|
111
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
112
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/content_types.json'), :headers => {})
|
113
|
+
|
114
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/assets/).
|
115
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
116
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/asset_collection.json'), :headers => {})
|
117
|
+
|
118
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/assets\/blt3ca1a3470787ba63/).
|
119
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
120
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/asset.json'), :headers => {})
|
121
|
+
|
122
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/content_types\/product\/entries/).
|
123
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
124
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/product_entry_collection.json'), :headers => {})
|
125
|
+
|
126
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/content_types\/product\/entries\/blt05056a2f5e0ebf76/).
|
127
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
128
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/product_entry.json'), :headers => {})
|
129
|
+
|
130
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/content_types\/category\/entries/).
|
131
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
132
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/category_entry_collection_without_count.json'), :headers => {})
|
133
|
+
|
134
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/content_types\/category\/entries.*include_count=true/).
|
135
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
136
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/category_entry_collection.json'), :headers => {})
|
137
|
+
|
138
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/content_types\/category\/entries\/blt05056a2f5e0ebf76/).
|
139
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
140
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/category_entry.json'), :headers => {})
|
141
|
+
end
|
142
|
+
|
143
|
+
def create_client(access_token = ENV['ACCESS_TOKEN'], api_key = ENV['API_KEY'], environment = ENV['STACK_ENV'])
|
144
|
+
Contentstack::Client.new(access_token, api_key, environment)
|
145
|
+
end
|
146
|
+
end
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: contentstack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rohit Sharma
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webmock
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Contentstack Ruby client for the Content Delivery API
|
70
|
+
email:
|
71
|
+
- rubygems@contentstack.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".yardopts"
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.rdoc
|
81
|
+
- contentstack.gemspec
|
82
|
+
- coverage/.last_run.json
|
83
|
+
- coverage/.resultset.json
|
84
|
+
- coverage/.resultset.json.lock
|
85
|
+
- coverage/assets/0.10.2/application.css
|
86
|
+
- coverage/assets/0.10.2/application.js
|
87
|
+
- coverage/assets/0.10.2/colorbox/border.png
|
88
|
+
- coverage/assets/0.10.2/colorbox/controls.png
|
89
|
+
- coverage/assets/0.10.2/colorbox/loading.gif
|
90
|
+
- coverage/assets/0.10.2/colorbox/loading_background.png
|
91
|
+
- coverage/assets/0.10.2/favicon_green.png
|
92
|
+
- coverage/assets/0.10.2/favicon_red.png
|
93
|
+
- coverage/assets/0.10.2/favicon_yellow.png
|
94
|
+
- coverage/assets/0.10.2/loading.gif
|
95
|
+
- coverage/assets/0.10.2/magnify.png
|
96
|
+
- coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
97
|
+
- coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
98
|
+
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
99
|
+
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
100
|
+
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
101
|
+
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
102
|
+
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
103
|
+
- coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
104
|
+
- coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png
|
105
|
+
- coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png
|
106
|
+
- coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png
|
107
|
+
- coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png
|
108
|
+
- coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png
|
109
|
+
- coverage/index.html
|
110
|
+
- lib/contentstack.rb
|
111
|
+
- lib/contentstack/api.rb
|
112
|
+
- lib/contentstack/asset.rb
|
113
|
+
- lib/contentstack/asset_collection.rb
|
114
|
+
- lib/contentstack/client.rb
|
115
|
+
- lib/contentstack/content_type.rb
|
116
|
+
- lib/contentstack/entry.rb
|
117
|
+
- lib/contentstack/entry_collection.rb
|
118
|
+
- lib/contentstack/error.rb
|
119
|
+
- lib/contentstack/query.rb
|
120
|
+
- lib/contentstack/version.rb
|
121
|
+
- lib/util.rb
|
122
|
+
- rakefile.rb
|
123
|
+
- spec/asset_collection_spec.rb
|
124
|
+
- spec/asset_spec.rb
|
125
|
+
- spec/content_type_spec.rb
|
126
|
+
- spec/contentstack_spec.rb
|
127
|
+
- spec/entry_collection_spec.rb
|
128
|
+
- spec/entry_spec.rb
|
129
|
+
- spec/fixtures/asset.json
|
130
|
+
- spec/fixtures/asset_collection.json
|
131
|
+
- spec/fixtures/category_entry.json
|
132
|
+
- spec/fixtures/category_entry_collection.json
|
133
|
+
- spec/fixtures/category_entry_collection_without_count.json
|
134
|
+
- spec/fixtures/content_types.json
|
135
|
+
- spec/fixtures/product_entry.json
|
136
|
+
- spec/fixtures/product_entry_collection.json
|
137
|
+
- spec/query_spec.rb
|
138
|
+
- spec/spec_helper.rb
|
139
|
+
homepage: https://github.com/builtio-contentstack/contentstack-ruby
|
140
|
+
licenses:
|
141
|
+
- MIT
|
142
|
+
metadata: {}
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
requirements: []
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.6.11
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: Contentstack Ruby client for the Content Delivery API
|
163
|
+
test_files: []
|