Class: ApipieBindings::Example

Inherits:
Object
  • Object
show all
Defined in:
lib/apipie_bindings/example.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_method, path, args, status, response) ⇒ Example

Returns a new instance of Example.



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

def initialize(http_method, path, args, status, response)
  @http_method = http_method
  @path = path
  @args = args
  @status = status.to_i
  @response = response
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/apipie_bindings/example.rb', line 5

def args
  @args
end

#http_methodObject (readonly)

Returns the value of attribute http_method.



5
6
7
# File 'lib/apipie_bindings/example.rb', line 5

def http_method
  @http_method
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/apipie_bindings/example.rb', line 5

def path
  @path
end

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/apipie_bindings/example.rb', line 5

def response
  @response
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/apipie_bindings/example.rb', line 5

def status
  @status
end

Class Method Details

.parse(example) ⇒ Object



15
16
17
18
# File 'lib/apipie_bindings/example.rb', line 15

def self.parse(example)
  prep = /(\w+)\ ([^\n]*)\n?(.*)?\n(\d+)\n(.*)/m.match(example)
  new(*prep[1..5]) if prep
end