Class: Kashflow::ApiMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/kashflow/api_method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, fields) ⇒ ApiMethod

Returns a new instance of ApiMethod.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/kashflow/api_method.rb', line 5

def initialize(name, fields)
  @name = name

  # split into request/response attrs
  @request_attrs, @response_attrs = fields.partition{|f| f[:direction] == 'IN' }.map do |arr| 
    arr.map do |fields| 
      # get rid of the :direction and cleanup the description text
      fields.slice!(:type, :desc, :name)
      fields[:desc].try(:strip!)
      fields
    end
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/kashflow/api_method.rb', line 3

def name
  @name
end

#request_attrsObject

Returns the value of attribute request_attrs.



3
4
5
# File 'lib/kashflow/api_method.rb', line 3

def request_attrs
  @request_attrs
end

#response_attrsObject

Returns the value of attribute response_attrs.



3
4
5
# File 'lib/kashflow/api_method.rb', line 3

def response_attrs
  @response_attrs
end