Class: TeamApi::Endpoint

Inherits:
Jekyll::Page
  • Object
show all
Defined in:
lib/team_api/endpoint.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site, endpoint_path) ⇒ Endpoint

Returns a new instance of Endpoint.



7
8
9
10
11
12
13
# File 'lib/team_api/endpoint.rb', line 7

def initialize(site, endpoint_path)
  @site = site
  @base = site.source
  @dir = endpoint_path
  @name = 'api.json'
  @data = {}
end

Class Method Details

.create(site, endpoint_path, data) ⇒ Object



15
16
17
18
19
20
# File 'lib/team_api/endpoint.rb', line 15

def self.create(site, endpoint_path, data)
  endpoint = new site, endpoint_path
  endpoint.process endpoint.name
  endpoint.content = data.to_json
  site.pages << endpoint
end