Class: ApiSpec::Spec
- Defined in:
- lib/api_spec/lib/api_spec/generator.rb,
lib/api_spec/lib/api_spec/specs/blogs.rb,
lib/api_spec/lib/api_spec/specs/lists.rb,
lib/api_spec/lib/api_spec/specs/paths.rb,
lib/api_spec/lib/api_spec/specs/sites.rb,
lib/api_spec/lib/api_spec/specs/events.rb,
lib/api_spec/lib/api_spec/specs/people.rb,
lib/api_spec/lib/api_spec/specs/exports.rb,
lib/api_spec/lib/api_spec/specs/imports.rb,
lib/api_spec/lib/api_spec/specs/surveys.rb,
lib/api_spec/lib/api_spec/specs/contacts.rb,
lib/api_spec/lib/api_spec/specs/webhooks.rb,
lib/api_spec/lib/api_spec/specs/calendars.rb,
lib/api_spec/lib/api_spec/specs/donations.rb,
lib/api_spec/lib/api_spec/specs/precincts.rb,
lib/api_spec/lib/api_spec/specs/blog_posts.rb,
lib/api_spec/lib/api_spec/specs/basic_pages.rb,
lib/api_spec/lib/api_spec/specs/memberships.rb,
lib/api_spec/lib/api_spec/specs/people_tags.rb,
lib/api_spec/lib/api_spec/specs/campaign_data.rb,
lib/api_spec/lib/api_spec/specs/page_attachments.rb,
lib/api_spec/lib/api_spec/specs/survey_responses.rb
Class Attribute Summary collapse
-
.endpoints ⇒ Object
Returns the value of attribute endpoints.
Class Method Summary collapse
Methods inherited from APIObject
init, #initialize, #nested_class, #nested_name, #to_hash
Constructor Details
This class inherits a constructor from ApiSpec::APIObject
Class Attribute Details
.endpoints ⇒ Object
Returns the value of attribute endpoints.
89 90 91 |
# File 'lib/api_spec/lib/api_spec/generator.rb', line 89 def endpoints @endpoints end |
Class Method Details
.endpoint(name) {|endpoint| ... } ⇒ Object
102 103 104 105 106 |
# File 'lib/api_spec/lib/api_spec/generator.rb', line 102 def self.endpoint(name) endpoint = Endpoint.new(name) yield endpoint endpoints << endpoint end |
.to_hash ⇒ Object
94 95 96 |
# File 'lib/api_spec/lib/api_spec/generator.rb', line 94 def self.to_hash { 'endpoints' => endpoints.map(&:to_hash) } end |
.write_spec(path) ⇒ Object
98 99 100 |
# File 'lib/api_spec/lib/api_spec/generator.rb', line 98 def self.write_spec(path) File.open(path, 'w') { |f| f.write(JSON.pretty_generate(to_hash)) } end |