Class: Jekyll::JamComments::Service
- Inherits:
-
Object
- Object
- Jekyll::JamComments::Service
- Defined in:
- lib/jekyll_jam_comments/service.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
Instance Method Summary collapse
- #fetch(path:) ⇒ Object
-
#initialize(domain:, api_key:, base_url: nil, environment: nil, client: HTTParty) ⇒ Service
constructor
A new instance of Service.
Constructor Details
#initialize(domain:, api_key:, base_url: nil, environment: nil, client: HTTParty) ⇒ Service
Returns a new instance of Service.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jekyll_jam_comments/service.rb', line 10 def initialize( domain:, api_key:, base_url: nil, environment: nil, client: HTTParty ) @client = client @domain = domain @api_key = api_key @base_url = base_url || "https://go.jamcomments.com" @environment = environment || "production" end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/jekyll_jam_comments/service.rb', line 8 def api_key @api_key end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
8 9 10 |
# File 'lib/jekyll_jam_comments/service.rb', line 8 def base_url @base_url end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/jekyll_jam_comments/service.rb', line 8 def client @client end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
8 9 10 |
# File 'lib/jekyll_jam_comments/service.rb', line 8 def domain @domain end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
8 9 10 |
# File 'lib/jekyll_jam_comments/service.rb', line 8 def environment @environment end |
Instance Method Details
#fetch(path:) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jekyll_jam_comments/service.rb', line 24 def fetch(path:) = { :query => { :path => formatted_path(path), :domain => domain, :stub => stub_value, }, :headers => { :Authorization => "Bearer #{api_key}", :Accept => "application/json", :"X-Platform" => "jekyll", }, } send_request() end |