Class: HaveAPI::Client::Parameters::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/haveapi/client/parameters/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, desc, value) ⇒ Resource

Returns a new instance of Resource.



5
6
7
8
# File 'lib/haveapi/client/parameters/resource.rb', line 5

def initialize(params, desc, value)
  @errors = []
  @value = coerce(value)
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/haveapi/client/parameters/resource.rb', line 3

def errors
  @errors
end

Instance Method Details

#to_apiObject



14
15
16
# File 'lib/haveapi/client/parameters/resource.rb', line 14

def to_api
  @value
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/haveapi/client/parameters/resource.rb', line 10

def valid?
  @errors.empty?
end