Class: PinterestSdkClient::Account

Inherits:
ApiModelBase show all
Defined in:
lib/pinterest_sdk/models/account.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Account

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/pinterest_sdk/models/account.rb', line 132

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::Account` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `PinterestSdkClient::Account`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'about')
    self.about = attributes[:'about']
  end

  if attributes.key?(:'account_type')
    self. = attributes[:'account_type']
  end

  if attributes.key?(:'board_count')
    self.board_count = attributes[:'board_count']
  end

  if attributes.key?(:'business_name')
    self.business_name = attributes[:'business_name']
  end

  if attributes.key?(:'follower_count')
    self.follower_count = attributes[:'follower_count']
  end

  if attributes.key?(:'following_count')
    self.following_count = attributes[:'following_count']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'monthly_views')
    self.monthly_views = attributes[:'monthly_views']
  end

  if attributes.key?(:'pin_count')
    self.pin_count = attributes[:'pin_count']
  end

  if attributes.key?(:'profile_image')
    self.profile_image = attributes[:'profile_image']
  end

  if attributes.key?(:'username')
    self.username = attributes[:'username']
  end

  if attributes.key?(:'website_url')
    self.website_url = attributes[:'website_url']
  end
end

Instance Attribute Details

#aboutObject

Profile about description.



19
20
21
# File 'lib/pinterest_sdk/models/account.rb', line 19

def about
  @about
end

#account_typeObject

Type of account



22
23
24
# File 'lib/pinterest_sdk/models/account.rb', line 22

def 
  @account_type
end

#board_countObject

User account board count.<br/>Note: Board count on user account level may differ from counts found elsewhere due to attribution of collaborative Boards.



25
26
27
# File 'lib/pinterest_sdk/models/account.rb', line 25

def board_count
  @board_count
end

#business_nameObject

Returns the value of attribute business_name.



27
28
29
# File 'lib/pinterest_sdk/models/account.rb', line 27

def business_name
  @business_name
end

#follower_countObject

User account follower count.



30
31
32
# File 'lib/pinterest_sdk/models/account.rb', line 30

def follower_count
  @follower_count
end

#following_countObject

User account following count.



33
34
35
# File 'lib/pinterest_sdk/models/account.rb', line 33

def following_count
  @following_count
end

#idObject

User account ID.



36
37
38
# File 'lib/pinterest_sdk/models/account.rb', line 36

def id
  @id
end

#monthly_viewsObject

User account monthly views.



39
40
41
# File 'lib/pinterest_sdk/models/account.rb', line 39

def monthly_views
  @monthly_views
end

#pin_countObject

User account pin count. This includes both created and saved pins.



42
43
44
# File 'lib/pinterest_sdk/models/account.rb', line 42

def pin_count
  @pin_count
end

#profile_imageObject

Returns the value of attribute profile_image.



44
45
46
# File 'lib/pinterest_sdk/models/account.rb', line 44

def profile_image
  @profile_image
end

#usernameObject

Returns the value of attribute username.



46
47
48
# File 'lib/pinterest_sdk/models/account.rb', line 46

def username
  @username
end

#website_urlObject

Returns the value of attribute website_url.



48
49
50
# File 'lib/pinterest_sdk/models/account.rb', line 48

def website_url
  @website_url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



91
92
93
# File 'lib/pinterest_sdk/models/account.rb', line 91

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



96
97
98
# File 'lib/pinterest_sdk/models/account.rb', line 96

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/pinterest_sdk/models/account.rb', line 73

def self.attribute_map
  {
    :'about' => :'about',
    :'account_type' => :'account_type',
    :'board_count' => :'board_count',
    :'business_name' => :'business_name',
    :'follower_count' => :'follower_count',
    :'following_count' => :'following_count',
    :'id' => :'id',
    :'monthly_views' => :'monthly_views',
    :'pin_count' => :'pin_count',
    :'profile_image' => :'profile_image',
    :'username' => :'username',
    :'website_url' => :'website_url'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/pinterest_sdk/models/account.rb', line 277

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



119
120
121
122
123
124
125
126
127
128
# File 'lib/pinterest_sdk/models/account.rb', line 119

def self.openapi_nullable
  Set.new([
    :'board_count',
    :'business_name',
    :'follower_count',
    :'following_count',
    :'monthly_views',
    :'pin_count',
  ])
end

.openapi_typesObject

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/pinterest_sdk/models/account.rb', line 101

def self.openapi_types
  {
    :'about' => :'String',
    :'account_type' => :'String',
    :'board_count' => :'Integer',
    :'business_name' => :'String',
    :'follower_count' => :'Integer',
    :'following_count' => :'Integer',
    :'id' => :'String',
    :'monthly_views' => :'Integer',
    :'pin_count' => :'Integer',
    :'profile_image' => :'String',
    :'username' => :'String',
    :'website_url' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/pinterest_sdk/models/account.rb', line 245

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      about == o.about &&
       == o. &&
      board_count == o.board_count &&
      business_name == o.business_name &&
      follower_count == o.follower_count &&
      following_count == o.following_count &&
      id == o.id &&
      monthly_views == o.monthly_views &&
      pin_count == o.pin_count &&
      profile_image == o.profile_image &&
      username == o.username &&
      website_url == o.website_url
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


264
265
266
# File 'lib/pinterest_sdk/models/account.rb', line 264

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



270
271
272
# File 'lib/pinterest_sdk/models/account.rb', line 270

def hash
  [about, , board_count, business_name, follower_count, following_count, id, monthly_views, pin_count, profile_image, username, website_url].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



197
198
199
200
201
202
203
204
205
206
# File 'lib/pinterest_sdk/models/account.rb', line 197

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^\d+$/)
  if !@id.nil? && @id !~ pattern
    invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/pinterest_sdk/models/account.rb', line 299

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



210
211
212
213
214
215
216
# File 'lib/pinterest_sdk/models/account.rb', line 210

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
   = EnumAttributeValidator.new('String', ["PINNER", "BUSINESS"])
  return false unless .valid?(@account_type)
  return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
  true
end