Class: SfCli::Sf::Sobject::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/sf_cli/sf/sobject/schema.rb

Defined Under Namespace

Classes: Field, Fields

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ Schema

Returns a new instance of Schema.



5
6
7
# File 'lib/sf_cli/sf/sobject/schema.rb', line 5

def initialize(schema)
  @schema = schema
end

Instance Method Details

#action_overridesObject



45
46
47
# File 'lib/sf_cli/sf/sobject/schema.rb', line 45

def action_overrides
  schema["actionOverrides"]
end

#activateable?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/sf_cli/sf/sobject/schema.rb', line 49

def activateable?
  schema["activateable"]
end

#associateEntityTypeObject



53
54
55
# File 'lib/sf_cli/sf/sobject/schema.rb', line 53

def associateEntityType
  schema["associateEntityType"]
end

#associateParentEntityObject



57
58
59
# File 'lib/sf_cli/sf/sobject/schema.rb', line 57

def associateParentEntity
  schema["associateParentEntity"]
end

#children_relationsObject



29
30
31
32
33
# File 'lib/sf_cli/sf/sobject/schema.rb', line 29

def children_relations
  schema['childRelationships']
    .select{|r| r['relationshipName'].nil? == false}
    .map{|r| {name: r['relationshipName'].to_sym, field: r['field'].to_sym, class_name: r['childSObject'].to_sym}}
end

#compact_layoutable?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/sf_cli/sf/sobject/schema.rb', line 61

def compact_layoutable?
  schema["compactLayoutable"]
end

#createable?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/sf_cli/sf/sobject/schema.rb', line 65

def createable?
  schema["createable"]
end

#custom?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/sf_cli/sf/sobject/schema.rb', line 69

def custom?
  schema["custom"]
end

#custom_setting?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/sf_cli/sf/sobject/schema.rb', line 73

def custom_setting?
  schema["customSetting"]
end

#deep_cloneable?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/sf_cli/sf/sobject/schema.rb', line 77

def deep_cloneable?
  schema["deepCloneable"]
end

#default_implementationObject



81
82
83
# File 'lib/sf_cli/sf/sobject/schema.rb', line 81

def default_implementation
  schema["defaultImplementation"]
end

#deletable?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/sf_cli/sf/sobject/schema.rb', line 85

def deletable?
  schema["deletable"]
end

#deprecated_and_hidden?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/sf_cli/sf/sobject/schema.rb', line 89

def deprecated_and_hidden?
  schema["deprecatedAndHidden"]
end

#extended_byObject



93
94
95
# File 'lib/sf_cli/sf/sobject/schema.rb', line 93

def extended_by
  schema["extendedBy"]
end

#extends_interfacesObject



97
98
99
# File 'lib/sf_cli/sf/sobject/schema.rb', line 97

def extends_interfaces
  schema["extendsInterfaces"]
end

#feed_enabled?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/sf_cli/sf/sobject/schema.rb', line 101

def feed_enabled?
  schema["feedEnabled"]
end

#field_labelsObject



25
26
27
# File 'lib/sf_cli/sf/sobject/schema.rb', line 25

def field_labels
  @field_labels ||= fields.map{|f| f.label}
end

#field_namesObject



21
22
23
# File 'lib/sf_cli/sf/sobject/schema.rb', line 21

def field_names
  @field_names ||= fields.map{|f| f.name.to_sym}
end

#fieldsObject



17
18
19
# File 'lib/sf_cli/sf/sobject/schema.rb', line 17

def fields
  @fields ||= Fields.new(schema)
end

#has_subtypes?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/sf_cli/sf/sobject/schema.rb', line 105

def has_subtypes?
  schema["hasSubtypes"]
end

#implemented_byObject



109
110
111
# File 'lib/sf_cli/sf/sobject/schema.rb', line 109

def implemented_by
  schema["implementedBy"]
end

#implements_interfacesObject



113
114
115
# File 'lib/sf_cli/sf/sobject/schema.rb', line 113

def implements_interfaces
  schema["implementsInterfaces"]
end

#interface?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/sf_cli/sf/sobject/schema.rb', line 117

def interface?
  schema["isInterface"]
end

#key_prefixObject



125
126
127
# File 'lib/sf_cli/sf/sobject/schema.rb', line 125

def key_prefix
  schema["keyPrefix"]
end

#labelObject



13
14
15
# File 'lib/sf_cli/sf/sobject/schema.rb', line 13

def label
  schema['label']
end

#label_pluralObject



129
130
131
# File 'lib/sf_cli/sf/sobject/schema.rb', line 129

def label_plural
  schema["labelPlural"]
end

#layoutable?Boolean

Returns:

  • (Boolean)


133
134
135
# File 'lib/sf_cli/sf/sobject/schema.rb', line 133

def layoutable?
  schema["layoutable"]
end

#listviewable?Boolean

Returns:

  • (Boolean)


137
138
139
# File 'lib/sf_cli/sf/sobject/schema.rb', line 137

def listviewable?
  schema["listviewable"]
end

#lookup_layoutableObject



141
142
143
# File 'lib/sf_cli/sf/sobject/schema.rb', line 141

def lookup_layoutable
  schema["lookupLayoutable"]
end

#mergeable?Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/sf_cli/sf/sobject/schema.rb', line 145

def mergeable?
  schema["mergeable"]
end

#mruEnabledObject



149
150
151
# File 'lib/sf_cli/sf/sobject/schema.rb', line 149

def mruEnabled
  schema["mruEnabled"]
end

#nameObject



9
10
11
# File 'lib/sf_cli/sf/sobject/schema.rb', line 9

def name
  schema['name']
end

#named_layoutsObject



153
154
155
# File 'lib/sf_cli/sf/sobject/schema.rb', line 153

def named_layouts
  schema["namedLayoutInfos"]
end

#network_scope_field_nameObject



157
158
159
# File 'lib/sf_cli/sf/sobject/schema.rb', line 157

def network_scope_field_name
  schema["networkScopeFieldName"]
end

#parent_relationsObject



35
36
37
38
39
# File 'lib/sf_cli/sf/sobject/schema.rb', line 35

def parent_relations
  fields
    .select{|f| !(f.relationship_name.nil? || f.reference_to.nil?) && f.reference_to.size > 0}
    .map{|f| {name: f.relationship_name.to_sym, field: f.name.to_sym, class_name: f.reference_to.first.to_sym} }
end

#queryable?Boolean

Returns:

  • (Boolean)


161
162
163
# File 'lib/sf_cli/sf/sobject/schema.rb', line 161

def queryable?
  schema["queryable"]
end

#record_typesObject



165
166
167
# File 'lib/sf_cli/sf/sobject/schema.rb', line 165

def record_types
  schema["recordTypeInfos"]
end

#replicateable?Boolean

Returns:

  • (Boolean)


169
170
171
# File 'lib/sf_cli/sf/sobject/schema.rb', line 169

def replicateable?
  schema["replicateable"]
end

#retrieveable?Boolean

Returns:

  • (Boolean)


173
174
175
# File 'lib/sf_cli/sf/sobject/schema.rb', line 173

def retrieveable?
  schema["retrieveable"]
end

#search_layoutable?Boolean

Returns:

  • (Boolean)


177
178
179
# File 'lib/sf_cli/sf/sobject/schema.rb', line 177

def search_layoutable?
  schema["searchLayoutable"]
end

#searchable?Boolean

Returns:

  • (Boolean)


181
182
183
# File 'lib/sf_cli/sf/sobject/schema.rb', line 181

def searchable?
  schema["searchable"]
end

#sobject_describe_optionObject



185
186
187
# File 'lib/sf_cli/sf/sobject/schema.rb', line 185

def sobject_describe_option
  schema["sobjectDescribeOption"]
end

#subtype?Boolean

Returns:

  • (Boolean)


121
122
123
# File 'lib/sf_cli/sf/sobject/schema.rb', line 121

def subtype?
  schema["isSubtype"]
end

#supported_scopesObject



189
190
191
# File 'lib/sf_cli/sf/sobject/schema.rb', line 189

def supported_scopes
  schema["supportedScopes"]
end

#to_hObject



41
42
43
# File 'lib/sf_cli/sf/sobject/schema.rb', line 41

def to_h
  schema
end

#triggerable?Boolean

Returns:

  • (Boolean)


193
194
195
# File 'lib/sf_cli/sf/sobject/schema.rb', line 193

def triggerable?
  schema["triggerable"]
end

#undeletable?Boolean

Returns:

  • (Boolean)


197
198
199
# File 'lib/sf_cli/sf/sobject/schema.rb', line 197

def undeletable?
  schema["undeletable"]
end

#updateable?Boolean

Returns:

  • (Boolean)


201
202
203
# File 'lib/sf_cli/sf/sobject/schema.rb', line 201

def updateable?
  schema["updateable"]
end

#urlsObject



205
206
207
# File 'lib/sf_cli/sf/sobject/schema.rb', line 205

def urls
  schema["urls"]
end