Class: Gonebusy::EntitiesCategoryResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/entities_category_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(description = nil, id = nil, is_active = nil, long_name = nil, name = nil, parent_category_id = nil, short_name = nil, subcategories = nil) ⇒ EntitiesCategoryResponse

Returns a new instance of EntitiesCategoryResponse.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gonebusy/models/entities_category_response.rb', line 53

def initialize(description = nil,
               id = nil,
               is_active = nil,
               long_name = nil,
               name = nil,
               parent_category_id = nil,
               short_name = nil,
               subcategories = nil)
  @description = description
  @id = id
  @is_active = is_active
  @long_name = long_name
  @name = name
  @parent_category_id = parent_category_id
  @short_name = short_name
  @subcategories = subcategories
end

Instance Attribute Details

#descriptionString

description of Category

Returns:



7
8
9
# File 'lib/gonebusy/models/entities_category_response.rb', line 7

def description
  @description
end

#idInteger

id of Category

Returns:

  • (Integer)


11
12
13
# File 'lib/gonebusy/models/entities_category_response.rb', line 11

def id
  @id
end

#is_activeBoolean

status of Category

Returns:

  • (Boolean)


15
16
17
# File 'lib/gonebusy/models/entities_category_response.rb', line 15

def is_active
  @is_active
end

#long_nameString

extended name for Category

Returns:



19
20
21
# File 'lib/gonebusy/models/entities_category_response.rb', line 19

def long_name
  @long_name
end

#nameString

name of Category

Returns:



23
24
25
# File 'lib/gonebusy/models/entities_category_response.rb', line 23

def name
  @name
end

#parent_category_idInteger

id of parent Category, if any

Returns:

  • (Integer)


27
28
29
# File 'lib/gonebusy/models/entities_category_response.rb', line 27

def parent_category_id
  @parent_category_id
end

#short_nameString

abbreviated name for Category

Returns:



31
32
33
# File 'lib/gonebusy/models/entities_category_response.rb', line 31

def short_name
  @short_name
end

#subcategoriesList of Integer

array of subcategory ids, if any

Returns:

  • (List of Integer)


35
36
37
# File 'lib/gonebusy/models/entities_category_response.rb', line 35

def subcategories
  @subcategories
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/gonebusy/models/entities_category_response.rb', line 72

def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash
    description = hash["description"]
    id = hash["id"]
    is_active = hash["is_active"]
    long_name = hash["long_name"]
    name = hash["name"]
    parent_category_id = hash["parent_category_id"]
    short_name = hash["short_name"]
    subcategories = hash["subcategories"]

    # Create object from extracted values
    EntitiesCategoryResponse.new(description,
                                 id,
                                 is_active,
                                 long_name,
                                 name,
                                 parent_category_id,
                                 short_name,
                                 subcategories)
  end
end

.namesObject

A mapping from model property names to API property names



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gonebusy/models/entities_category_response.rb', line 38

def self.names
  if @hash.nil?
    @hash = {}
    @hash["description"] = "description"
    @hash["id"] = "id"
    @hash["is_active"] = "is_active"
    @hash["long_name"] = "long_name"
    @hash["name"] = "name"
    @hash["parent_category_id"] = "parent_category_id"
    @hash["short_name"] = "short_name"
    @hash["subcategories"] = "subcategories"
  end
  @hash
end