Class: PinterestSdkClient::Account
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- PinterestSdkClient::Account
- Defined in:
- lib/pinterest_sdk/models/account.rb
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.<br/>Note: Board count on user account level may differ from counts found elsewhere due to attribution of collaborative Boards.
-
#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
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.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.
19 20 21 |
# File 'lib/pinterest_sdk/models/account.rb', line 19 def about @about end |
#account_type ⇒ Object
Type of account
22 23 24 |
# File 'lib/pinterest_sdk/models/account.rb', line 22 def account_type @account_type end |
#board_count ⇒ Object
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_name ⇒ Object
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_count ⇒ Object
User account follower count.
30 31 32 |
# File 'lib/pinterest_sdk/models/account.rb', line 30 def follower_count @follower_count end |
#following_count ⇒ Object
User account following count.
33 34 35 |
# File 'lib/pinterest_sdk/models/account.rb', line 33 def following_count @following_count end |
#id ⇒ Object
User account ID.
36 37 38 |
# File 'lib/pinterest_sdk/models/account.rb', line 36 def id @id end |
#monthly_views ⇒ Object
User account monthly views.
39 40 41 |
# File 'lib/pinterest_sdk/models/account.rb', line 39 def monthly_views @monthly_views end |
#pin_count ⇒ Object
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_image ⇒ Object
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 |
#username ⇒ Object
Returns the value of attribute username.
46 47 48 |
# File 'lib/pinterest_sdk/models/account.rb', line 46 def username @username end |
#website_url ⇒ Object
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_map ⇒ Object
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_attributes ⇒ Object
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_map ⇒ Object
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
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_nullable ⇒ Object
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_types ⇒ Object
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.
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 && 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
264 265 266 |
# File 'lib/pinterest_sdk/models/account.rb', line 264 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
270 271 272 |
# File 'lib/pinterest_sdk/models/account.rb', line 270 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?
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_hash ⇒ 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
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' account_type_validator = EnumAttributeValidator.new('String', ["PINNER", "BUSINESS"]) return false unless account_type_validator.valid?(@account_type) return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/) true end |