Class: BrickFTP::Webhook::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/brick_ftp/webhook/request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action: nil, interface: nil, path: nil, destination: nil, at: nil, username: nil, type: nil) ⇒ Request

Returns a new instance of Request.



17
18
19
20
21
22
23
24
25
# File 'lib/brick_ftp/webhook/request.rb', line 17

def initialize(action: nil, interface: nil, path: nil, destination: nil, at: nil, username: nil, type: nil)
  @action = action
  @interface = interface
  @path = path
  @destination = destination
  @at = at
  @username = username
  @type = type
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



6
7
8
# File 'lib/brick_ftp/webhook/request.rb', line 6

def action
  @action
end

#atObject (readonly)

Returns the value of attribute at.



6
7
8
# File 'lib/brick_ftp/webhook/request.rb', line 6

def at
  @at
end

#destinationObject (readonly)

Returns the value of attribute destination.



6
7
8
# File 'lib/brick_ftp/webhook/request.rb', line 6

def destination
  @destination
end

#interfaceObject (readonly)

Returns the value of attribute interface.



6
7
8
# File 'lib/brick_ftp/webhook/request.rb', line 6

def interface
  @interface
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/brick_ftp/webhook/request.rb', line 6

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/brick_ftp/webhook/request.rb', line 6

def type
  @type
end

#usernameObject (readonly)

Returns the value of attribute username.



6
7
8
# File 'lib/brick_ftp/webhook/request.rb', line 6

def username
  @username
end

Class Method Details

.from_query_string(query_string) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/brick_ftp/webhook/request.rb', line 8

def self.from_query_string(query_string)
  params = query_string.split('&').each_with_object({}) do |pair, res|
    key, value = pair.split('=').map { |x| CGI.unescape(x) }
    res[key.to_sym] = value
  end

  new(params)
end