Class: Locomotive::Coal::ClientV2

Inherits:
Client
  • Object
show all
Defined in:
lib/locomotive/coal/client_v2.rb

Instance Attribute Summary collapse

Attributes inherited from Client

#credentials, #options, #uri

Instance Method Summary collapse

Methods inherited from Client

#accounts, #content_assets, #content_entries, #content_types, #current_site, #engine_version, #initialize, #memberships, #my_account, #pages, #reset, #sections, #sites, #snippets, #ssl?, #theme_assets, #token, #translations

Constructor Details

This class inherits a constructor from Locomotive::Coal::Client

Instance Attribute Details

#scoped_by_siteObject

Returns the value of attribute scoped_by_site.



5
6
7
# File 'lib/locomotive/coal/client_v2.rb', line 5

def scoped_by_site
  @scoped_by_site
end

Instance Method Details

#scope_by(site) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/locomotive/coal/client_v2.rb', line 7

def scope_by(site)
  if site.domains.include?(domain)
    self
  else
    new_uri = site.domains.first

    self.class.new(new_uri, credentials, options).tap do |_client|
      _client.scoped_by_site = true
    end
  end
end