Class: WCC::Contentful::SimpleClient::Cdn
- Inherits:
-
WCC::Contentful::SimpleClient
- Object
- WCC::Contentful::SimpleClient
- WCC::Contentful::SimpleClient::Cdn
- Defined in:
- lib/wcc/contentful/simple_client.rb
Instance Method Summary collapse
- #asset(key, query = {}) ⇒ Object
- #assets(query = {}) ⇒ Object
- #content_types(query = {}) ⇒ Object
- #entries(query = {}) ⇒ Object
- #entry(key, query = {}) ⇒ Object
-
#initialize(space:, access_token:, **options) ⇒ Cdn
constructor
A new instance of Cdn.
- #sync(sync_token: nil, **query) ⇒ Object
Methods inherited from WCC::Contentful::SimpleClient
Constructor Details
#initialize(space:, access_token:, **options) ⇒ Cdn
Returns a new instance of Cdn.
61 62 63 64 65 66 67 68 |
# File 'lib/wcc/contentful/simple_client.rb', line 61 def initialize(space:, access_token:, **) super( api_url: [:api_url] || 'https://cdn.contentful.com/', space: space, access_token: access_token, ** ) end |
Instance Method Details
#asset(key, query = {}) ⇒ Object
80 81 82 83 |
# File 'lib/wcc/contentful/simple_client.rb', line 80 def asset(key, query = {}) resp = get("assets/#{key}", query) resp.assert_ok! end |
#assets(query = {}) ⇒ Object
85 86 87 88 |
# File 'lib/wcc/contentful/simple_client.rb', line 85 def assets(query = {}) resp = get('assets', query) resp.assert_ok! end |
#content_types(query = {}) ⇒ Object
90 91 92 93 |
# File 'lib/wcc/contentful/simple_client.rb', line 90 def content_types(query = {}) resp = get('content_types', query) resp.assert_ok! end |
#entries(query = {}) ⇒ Object
75 76 77 78 |
# File 'lib/wcc/contentful/simple_client.rb', line 75 def entries(query = {}) resp = get('entries', query) resp.assert_ok! end |
#entry(key, query = {}) ⇒ Object
70 71 72 73 |
# File 'lib/wcc/contentful/simple_client.rb', line 70 def entry(key, query = {}) resp = get("entries/#{key}", query) resp.assert_ok! end |
#sync(sync_token: nil, **query) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/wcc/contentful/simple_client.rb', line 95 def sync(sync_token: nil, **query) sync_token = if sync_token { sync_token: sync_token } else { initial: true } end query = query.merge(sync_token) resp = SyncResponse.new(get('sync', query)) resp.assert_ok! end |