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, Relation, Relations

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



51
52
53
# File 'lib/sf_cli/sf/sobject/schema.rb', line 51

def action_overrides
  schema["actionOverrides"]
end

#activateable?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/sf_cli/sf/sobject/schema.rb', line 55

def activateable?
  schema["activateable"]
end

#associateEntityTypeObject



59
60
61
# File 'lib/sf_cli/sf/sobject/schema.rb', line 59

def associateEntityType
  schema["associateEntityType"]
end

#associateParentEntityObject



63
64
65
# File 'lib/sf_cli/sf/sobject/schema.rb', line 63

def associateParentEntity
  schema["associateParentEntity"]
end

#children_relationsObject



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

def children_relations
  @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)


67
68
69
# File 'lib/sf_cli/sf/sobject/schema.rb', line 67

def compact_layoutable?
  schema["compactLayoutable"]
end

#createable?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/sf_cli/sf/sobject/schema.rb', line 71

def createable?
  schema["createable"]
end

#custom?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/sf_cli/sf/sobject/schema.rb', line 75

def custom?
  schema["custom"]
end

#custom_setting?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/sf_cli/sf/sobject/schema.rb', line 79

def custom_setting?
  schema["customSetting"]
end

#deep_cloneable?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/sf_cli/sf/sobject/schema.rb', line 83

def deep_cloneable?
  schema["deepCloneable"]
end

#default_implementationObject



87
88
89
# File 'lib/sf_cli/sf/sobject/schema.rb', line 87

def default_implementation
  schema["defaultImplementation"]
end

#deletable?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/sf_cli/sf/sobject/schema.rb', line 91

def deletable?
  schema["deletable"]
end

#deprecated_and_hidden?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/sf_cli/sf/sobject/schema.rb', line 95

def deprecated_and_hidden?
  schema["deprecatedAndHidden"]
end

#extended_byObject



99
100
101
# File 'lib/sf_cli/sf/sobject/schema.rb', line 99

def extended_by
  schema["extendedBy"]
end

#extends_interfacesObject



103
104
105
# File 'lib/sf_cli/sf/sobject/schema.rb', line 103

def extends_interfaces
  schema["extendsInterfaces"]
end

#feed_enabled?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/sf_cli/sf/sobject/schema.rb', line 107

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}.sort
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}.sort
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)


111
112
113
# File 'lib/sf_cli/sf/sobject/schema.rb', line 111

def has_subtypes?
  schema["hasSubtypes"]
end

#implemented_byObject



115
116
117
# File 'lib/sf_cli/sf/sobject/schema.rb', line 115

def implemented_by
  schema["implementedBy"]
end

#implements_interfacesObject



119
120
121
# File 'lib/sf_cli/sf/sobject/schema.rb', line 119

def implements_interfaces
  schema["implementsInterfaces"]
end

#interface?Boolean

Returns:

  • (Boolean)


123
124
125
# File 'lib/sf_cli/sf/sobject/schema.rb', line 123

def interface?
  schema["isInterface"]
end

#key_prefixObject



131
132
133
# File 'lib/sf_cli/sf/sobject/schema.rb', line 131

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



135
136
137
# File 'lib/sf_cli/sf/sobject/schema.rb', line 135

def label_plural
  schema["labelPlural"]
end

#layoutable?Boolean

Returns:

  • (Boolean)


139
140
141
# File 'lib/sf_cli/sf/sobject/schema.rb', line 139

def layoutable?
  schema["layoutable"]
end

#listviewable?Boolean

Returns:

  • (Boolean)


143
144
145
# File 'lib/sf_cli/sf/sobject/schema.rb', line 143

def listviewable?
  schema["listviewable"]
end

#lookup_layoutableObject



147
148
149
# File 'lib/sf_cli/sf/sobject/schema.rb', line 147

def lookup_layoutable
  schema["lookupLayoutable"]
end

#mergeable?Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/sf_cli/sf/sobject/schema.rb', line 151

def mergeable?
  schema["mergeable"]
end

#mruEnabledObject



155
156
157
# File 'lib/sf_cli/sf/sobject/schema.rb', line 155

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



159
160
161
# File 'lib/sf_cli/sf/sobject/schema.rb', line 159

def named_layouts
  schema["namedLayoutInfos"]
end

#network_scope_field_nameObject



163
164
165
# File 'lib/sf_cli/sf/sobject/schema.rb', line 163

def network_scope_field_name
  schema["networkScopeFieldName"]
end

#parent_relationsObject



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

def parent_relations
  @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)


167
168
169
# File 'lib/sf_cli/sf/sobject/schema.rb', line 167

def queryable?
  schema["queryable"]
end

#record_typesObject



171
172
173
# File 'lib/sf_cli/sf/sobject/schema.rb', line 171

def record_types
  schema["recordTypeInfos"]
end

#relationsObject



43
44
45
# File 'lib/sf_cli/sf/sobject/schema.rb', line 43

def relations
  @relations ||= Relations.new(children_relations + parent_relations)
end

#replicateable?Boolean

Returns:

  • (Boolean)


175
176
177
# File 'lib/sf_cli/sf/sobject/schema.rb', line 175

def replicateable?
  schema["replicateable"]
end

#retrieveable?Boolean

Returns:

  • (Boolean)


179
180
181
# File 'lib/sf_cli/sf/sobject/schema.rb', line 179

def retrieveable?
  schema["retrieveable"]
end

#search_layoutable?Boolean

Returns:

  • (Boolean)


183
184
185
# File 'lib/sf_cli/sf/sobject/schema.rb', line 183

def search_layoutable?
  schema["searchLayoutable"]
end

#searchable?Boolean

Returns:

  • (Boolean)


187
188
189
# File 'lib/sf_cli/sf/sobject/schema.rb', line 187

def searchable?
  schema["searchable"]
end

#sobject_describe_optionObject



191
192
193
# File 'lib/sf_cli/sf/sobject/schema.rb', line 191

def sobject_describe_option
  schema["sobjectDescribeOption"]
end

#subtype?Boolean

Returns:

  • (Boolean)


127
128
129
# File 'lib/sf_cli/sf/sobject/schema.rb', line 127

def subtype?
  schema["isSubtype"]
end

#supported_scopesObject



195
196
197
# File 'lib/sf_cli/sf/sobject/schema.rb', line 195

def supported_scopes
  schema["supportedScopes"]
end

#to_hObject



47
48
49
# File 'lib/sf_cli/sf/sobject/schema.rb', line 47

def to_h
  schema
end

#triggerable?Boolean

Returns:

  • (Boolean)


199
200
201
# File 'lib/sf_cli/sf/sobject/schema.rb', line 199

def triggerable?
  schema["triggerable"]
end

#undeletable?Boolean

Returns:

  • (Boolean)


203
204
205
# File 'lib/sf_cli/sf/sobject/schema.rb', line 203

def undeletable?
  schema["undeletable"]
end

#updateable?Boolean

Returns:

  • (Boolean)


207
208
209
# File 'lib/sf_cli/sf/sobject/schema.rb', line 207

def updateable?
  schema["updateable"]
end

#urlsObject



211
212
213
# File 'lib/sf_cli/sf/sobject/schema.rb', line 211

def urls
  schema["urls"]
end