Sha256: 72cdcef3ed3e66e4857eee0ae19572a88118bc74ab3370c59d50a27126c34da1

Contents?: true

Size: 868 Bytes

Versions: 15

Compression:

Stored size: 868 Bytes

Contents

module TryApi
  class Method < TryApi::Base
    typesafe_accessor :title, String
    typesafe_accessor :description, String
    typesafe_accessor :parameters, Array, items_type: TryApi::Parameter
    typesafe_accessor :headers, Array, items_type: TryApi::Header
    typesafe_accessor :cookies, Array, items_type: TryApi::Cookie
    typesafe_accessor :path, String
    typesafe_accessor :method, String
    typesafe_accessor :example_responses, Array, items_type: TryApi::ExampleResponse
    typesafe_accessor :api_prefix, String
    typesafe_accessor :identifier, Hash

    def to_json(id)
      super(id).merge local_path: local_path, full_path: full_path
    end

    def full_path
      "#{ project.endpoint }/#{ project.api_prefix }#{ self.path }"
    end

    def local_path
      "/#{ self.api_prefix || self.project.api_prefix }#{ self.path }"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
try_api-0.1.18 app/models/try_api/method.rb
try_api-0.1.17 app/models/try_api/method.rb
try_api-0.1.16 app/models/try_api/method.rb
try_api-0.1.15 app/models/try_api/method.rb
try_api-0.1.14 app/models/try_api/method.rb
try_api-0.1.13 app/models/try_api/method.rb
try_api-0.1.12 app/models/try_api/method.rb
try_api-0.1.11 app/models/try_api/method.rb
try_api-0.1.10 app/models/try_api/method.rb
try_api-0.1.9 app/models/try_api/method.rb
try_api-0.1.8 app/models/try_api/method.rb
try_api-0.1.7 app/models/try_api/method.rb
try_api-0.1.6 app/models/try_api/method.rb
try_api-0.1.5 app/models/try_api/method.rb
try_api-0.1.4 app/models/try_api/method.rb