class Teleswagger::SendInvoiceBody
Attributes
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/teleswagger/models/send_invoice_body.rb, line 73 def self.attribute_map { :'chat_id' => :'chat_id', :'title' => :'title', :'description' => :'description', :'payload' => :'payload', :'provider_token' => :'provider_token', :'start_parameter' => :'start_parameter', :'currency' => :'currency', :'prices' => :'prices', :'provider_data' => :'provider_data', :'photo_url' => :'photo_url', :'photo_size' => :'photo_size', :'photo_width' => :'photo_width', :'photo_height' => :'photo_height', :'need_name' => :'need_name', :'need_phone_number' => :'need_phone_number', :'need_email' => :'need_email', :'need_shipping_address' => :'need_shipping_address', :'is_flexible' => :'is_flexible', :'disable_notification' => :'disable_notification', :'reply_to_message_id' => :'reply_to_message_id', :'reply_markup' => :'reply_markup' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/teleswagger/models/send_invoice_body.rb, line 128 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'chat_id') self.chat_id = attributes[:'chat_id'] end if attributes.has_key?(:'title') self.title = attributes[:'title'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'payload') self.payload = attributes[:'payload'] end if attributes.has_key?(:'provider_token') self.provider_token = attributes[:'provider_token'] end if attributes.has_key?(:'start_parameter') self.start_parameter = attributes[:'start_parameter'] end if attributes.has_key?(:'currency') self.currency = attributes[:'currency'] end if attributes.has_key?(:'prices') if (value = attributes[:'prices']).is_a?(Array) self.prices = value end end if attributes.has_key?(:'provider_data') self.provider_data = attributes[:'provider_data'] end if attributes.has_key?(:'photo_url') self.photo_url = attributes[:'photo_url'] end if attributes.has_key?(:'photo_size') self.photo_size = attributes[:'photo_size'] end if attributes.has_key?(:'photo_width') self.photo_width = attributes[:'photo_width'] end if attributes.has_key?(:'photo_height') self.photo_height = attributes[:'photo_height'] end if attributes.has_key?(:'need_name') self.need_name = attributes[:'need_name'] end if attributes.has_key?(:'need_phone_number') self.need_phone_number = attributes[:'need_phone_number'] end if attributes.has_key?(:'need_email') self.need_email = attributes[:'need_email'] end if attributes.has_key?(:'need_shipping_address') self.need_shipping_address = attributes[:'need_shipping_address'] end if attributes.has_key?(:'is_flexible') self.is_flexible = attributes[:'is_flexible'] end if attributes.has_key?(:'disable_notification') self.disable_notification = attributes[:'disable_notification'] end if attributes.has_key?(:'reply_to_message_id') self.reply_to_message_id = attributes[:'reply_to_message_id'] end if attributes.has_key?(:'reply_markup') self.reply_markup = attributes[:'reply_markup'] end end
Attribute type mapping.
# File lib/teleswagger/models/send_invoice_body.rb, line 100 def self.swagger_types { :'chat_id' => :'Integer', :'title' => :'String', :'description' => :'String', :'payload' => :'String', :'provider_token' => :'String', :'start_parameter' => :'String', :'currency' => :'String', :'prices' => :'Array<LabeledPrice>', :'provider_data' => :'String', :'photo_url' => :'String', :'photo_size' => :'Integer', :'photo_width' => :'Integer', :'photo_height' => :'Integer', :'need_name' => :'BOOLEAN', :'need_phone_number' => :'BOOLEAN', :'need_email' => :'BOOLEAN', :'need_shipping_address' => :'BOOLEAN', :'is_flexible' => :'BOOLEAN', :'disable_notification' => :'BOOLEAN', :'reply_to_message_id' => :'Integer', :'reply_markup' => :'Object' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/teleswagger/models/send_invoice_body.rb, line 245 def ==(o) return true if self.equal?(o) self.class == o.class && chat_id == o.chat_id && title == o.title && description == o.description && payload == o.payload && provider_token == o.provider_token && start_parameter == o.start_parameter && currency == o.currency && prices == o.prices && provider_data == o.provider_data && photo_url == o.photo_url && photo_size == o.photo_size && photo_width == o.photo_width && photo_height == o.photo_height && need_name == o.need_name && need_phone_number == o.need_phone_number && need_email == o.need_email && need_shipping_address == o.need_shipping_address && is_flexible == o.is_flexible && disable_notification == o.disable_notification && reply_to_message_id == o.reply_to_message_id && reply_markup == o.reply_markup end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/teleswagger/models/send_invoice_body.rb, line 307 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /^(true|t|yes|y|1)$/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = Teleswagger.const_get(type).new temp_model.build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/teleswagger/models/send_invoice_body.rb, line 373 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/teleswagger/models/send_invoice_body.rb, line 286 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
@see the `==` method @param [Object] Object to be compared
# File lib/teleswagger/models/send_invoice_body.rb, line 273 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/teleswagger/models/send_invoice_body.rb, line 279 def hash [chat_id, title, description, payload, provider_token, start_parameter, currency, prices, provider_data, photo_url, photo_size, photo_width, photo_height, need_name, need_phone_number, need_email, need_shipping_address, is_flexible, disable_notification, reply_to_message_id, reply_markup].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons
# File lib/teleswagger/models/send_invoice_body.rb, line 224 def list_invalid_properties invalid_properties = Array.new return invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/teleswagger/models/send_invoice_body.rb, line 359 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/teleswagger/models/send_invoice_body.rb, line 347 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/teleswagger/models/send_invoice_body.rb, line 231 def valid? return false if @chat_id.nil? return false if @title.nil? return false if @description.nil? return false if @payload.nil? return false if @provider_token.nil? return false if @start_parameter.nil? return false if @currency.nil? return false if @prices.nil? return true end