Class: PinterestSdkClient::Account
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- PinterestSdkClient::Account
- Defined in:
- lib/pinterest_sdk/models/account.rb
Overview
User account model containing properties related to a user's account.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#about ⇒ Object
Profile about description.
-
#account_type ⇒ Object
Type of account.
-
#board_count ⇒ Object
User account board count.
-
#business_name ⇒ Object
Returns the value of attribute business_name.
-
#follower_count ⇒ Object
User account follower count.
-
#following_count ⇒ Object
User account following count.
-
#id ⇒ Object
User account ID.
-
#monthly_views ⇒ Object
User account monthly views.
-
#pin_count ⇒ Object
User account pin count.
-
#profile_image ⇒ Object
Returns the value of attribute profile_image.
-
#username ⇒ Object
Returns the value of attribute username.
-
#website_url ⇒ Object
Returns the value of attribute website_url.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Account
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Account
Initializes the object
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 194 |
# File 'lib/pinterest_sdk/models/account.rb', line 133 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.account_type = 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
#about ⇒ Object
Profile about description.
20 21 22 |
# File 'lib/pinterest_sdk/models/account.rb', line 20 def about @about end |
#account_type ⇒ Object
Type of account
23 24 25 |
# File 'lib/pinterest_sdk/models/account.rb', line 23 def account_type @account_type end |
#board_count ⇒ Object
User account board count. Note: Board count on user account level may differ from counts found elsewhere due to attribution of collaborative Boards.
26 27 28 |
# File 'lib/pinterest_sdk/models/account.rb', line 26 def board_count @board_count end |
#business_name ⇒ Object
Returns the value of attribute business_name.
28 29 30 |
# File 'lib/pinterest_sdk/models/account.rb', line 28 def business_name @business_name end |
#follower_count ⇒ Object
User account follower count.
31 32 33 |
# File 'lib/pinterest_sdk/models/account.rb', line 31 def follower_count @follower_count end |
#following_count ⇒ Object
User account following count.
34 35 36 |
# File 'lib/pinterest_sdk/models/account.rb', line 34 def following_count @following_count end |
#id ⇒ Object
User account ID.
37 38 39 |
# File 'lib/pinterest_sdk/models/account.rb', line 37 def id @id end |
#monthly_views ⇒ Object
User account monthly views.
40 41 42 |
# File 'lib/pinterest_sdk/models/account.rb', line 40 def monthly_views @monthly_views end |
#pin_count ⇒ Object
User account pin count. This includes both created and saved pins.
43 44 45 |
# File 'lib/pinterest_sdk/models/account.rb', line 43 def pin_count @pin_count end |
#profile_image ⇒ Object
Returns the value of attribute profile_image.
45 46 47 |
# File 'lib/pinterest_sdk/models/account.rb', line 45 def profile_image @profile_image end |
#username ⇒ Object
Returns the value of attribute username.
47 48 49 |
# File 'lib/pinterest_sdk/models/account.rb', line 47 def username @username end |
#website_url ⇒ Object
Returns the value of attribute website_url.
49 50 51 |
# File 'lib/pinterest_sdk/models/account.rb', line 49 def website_url @website_url end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
92 93 94 |
# File 'lib/pinterest_sdk/models/account.rb', line 92 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
97 98 99 |
# File 'lib/pinterest_sdk/models/account.rb', line 97 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/pinterest_sdk/models/account.rb', line 74 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
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/pinterest_sdk/models/account.rb', line 266 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_nullable ⇒ Object
List of attributes with nullable: true
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/pinterest_sdk/models/account.rb', line 120 def self.openapi_nullable Set.new([ :'board_count', :'business_name', :'follower_count', :'following_count', :'monthly_views', :'pin_count', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/pinterest_sdk/models/account.rb', line 102 def self.openapi_types { :'about' => :'String', :'account_type' => :'UserAccountType', :'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.
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/pinterest_sdk/models/account.rb', line 234 def ==(o) return true if self.equal?(o) self.class == o.class && about == o.about && account_type == o.account_type && 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
253 254 255 |
# File 'lib/pinterest_sdk/models/account.rb', line 253 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
259 260 261 |
# File 'lib/pinterest_sdk/models/account.rb', line 259 def hash [about, account_type, board_count, business_name, follower_count, following_count, id, monthly_views, pin_count, profile_image, username, website_url].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
198 199 200 201 202 203 204 205 206 207 |
# File 'lib/pinterest_sdk/models/account.rb', line 198 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_hash ⇒ Hash
Returns the object in the form of hash
288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/pinterest_sdk/models/account.rb', line 288 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
211 212 213 214 215 |
# File 'lib/pinterest_sdk/models/account.rb', line 211 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/) true end |