Class: WCC::Contentful::Store::CDNAdapter::Query
- Inherits:
-
Base::Query
- Object
- Base::Query
- WCC::Contentful::Store::CDNAdapter::Query
- Defined in:
- lib/wcc/contentful/store/cdn_adapter.rb
Instance Method Summary collapse
- #eq(field, expected, context = nil) ⇒ Object
-
#initialize(client, relation) ⇒ Query
constructor
A new instance of Query.
- #result ⇒ Object
Methods inherited from Base::Query
Constructor Details
#initialize(client, relation) ⇒ Query
Returns a new instance of Query.
44 45 46 47 48 49 |
# File 'lib/wcc/contentful/store/cdn_adapter.rb', line 44 def initialize(client, relation) raise ArgumentError, 'Client cannot be nil' unless client.present? raise ArgumentError, 'content_type must be provided' unless relation[:content_type].present? @client = client @relation = relation end |
Instance Method Details
#eq(field, expected, context = nil) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/wcc/contentful/store/cdn_adapter.rb', line 51 def eq(field, expected, context = nil) locale = context[:locale] if context.present? locale ||= 'en-US' Query.new(@client, @relation.merge("fields.#{field}.#{locale}" => expected)) end |
#result ⇒ Object
40 41 42 |
# File 'lib/wcc/contentful/store/cdn_adapter.rb', line 40 def result resolve.items end |