Class: Attune::Model::BlacklistParams

Inherits:
Object
  • Object
show all
Defined in:
lib/attune/models/blacklist_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BlacklistParams

Returns a new instance of BlacklistParams.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/attune/models/blacklist_params.rb', line 30

def initialize(attributes = {})
  return if attributes.empty?
  # Workaround since JSON.parse has accessors as strings rather than symbols
  @disabled = attributes["disabled"] || attributes[:"disabled"]
  # Workaround since JSON.parse has accessors as strings rather than symbols
  @entity_type = attributes["entityType"] || attributes[:"entity_type"]
  value = attributes["ids"] || attributes[:"ids"]
  if value.is_a?(Array)
    @ids = value

  end
  value = attributes["scope"] || attributes[:"scope"]
  if value.is_a?(Array)
    @scope = value.map{ |v| ScopeEntry.new(v) }

  end
  # Workaround since JSON.parse has accessors as strings rather than symbols
  @active_from = attributes["activeFrom"] || attributes[:"active_from"]
  # Workaround since JSON.parse has accessors as strings rather than symbols
  @active_to = attributes["activeTo"] || attributes[:"active_to"]
  

end

Instance Attribute Details

#active_fromString

Returns the current value of active_from.

Returns:

  • (String)

    the current value of active_from



11
12
13
# File 'lib/attune/models/blacklist_params.rb', line 11

def active_from
  @active_from
end

#active_toString

Returns the current value of active_to.

Returns:

  • (String)

    the current value of active_to



11
12
13
# File 'lib/attune/models/blacklist_params.rb', line 11

def active_to
  @active_to
end

#disabledBoolean

Returns the current value of disabled.

Returns:

  • (Boolean)

    the current value of disabled



11
12
13
# File 'lib/attune/models/blacklist_params.rb', line 11

def disabled
  @disabled
end

#entity_typeString

Returns the current value of entity_type.

Returns:

  • (String)

    the current value of entity_type



11
12
13
# File 'lib/attune/models/blacklist_params.rb', line 11

def entity_type
  @entity_type
end

#idsArray<String>

Returns the current value of ids.

Returns:

  • (Array<String>)

    the current value of ids



11
12
13
# File 'lib/attune/models/blacklist_params.rb', line 11

def ids
  @ids
end

#scopeArray<Attune::Model::ScopeEntry>

Returns the current value of scope.

Returns:



11
12
13
# File 'lib/attune/models/blacklist_params.rb', line 11

def scope
  @scope
end

Instance Method Details

#to_bodyObject



54
55
56
57
58
59
# File 'lib/attune/models/blacklist_params.rb', line 54

def to_body
  Hash[ATTRIBUTE_MAP.map do |internal, external|
    next unless value = send(internal)
    [external, value]
  end.compact]
end

#to_json(options = {}) ⇒ Object



61
62
63
# File 'lib/attune/models/blacklist_params.rb', line 61

def to_json(options = {})
  to_body.to_json
end