class SquareConnect::OrderFulfillmentPickupDetails
Contains details necessary to fulfill a pickup order.
Attributes
The [timestamp](workingwithdates) in RFC3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z", indicating when the fulfillment was accepted by the merchant.
The auto completion duration in RFC3339 duration format, e.g., "P1W3D". If set, an open and accepted pickup fulfillment will automatically move to the `COMPLETED` state after this period of time. If not set, this pickup fulfillment will remain accepted until it is canceled or completed.
A description of why the pickup was canceled. Max length is 100 characters.
The [timestamp](workingwithdates) in RFC3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z", indicating when the fulfillment was canceled by the merchant or buyer.
The [timestamp](workingwithdates) in RFC3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z", indicating when the fulfillment expired.
The expiry [timestamp](workingwithdates) in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". This timestamp indicates when the pickup fulfillment will expire if it is not accepted by the merchant. Expiration time can only be set up to 7 days in the future. If not set, this pickup fulfillment will be automatically accepted when placed.
A general note about the pickup fulfillment. Notes are useful for providing additional instructions and are displayed in Square apps.
The [timestamp](workingwithdates) in RFC3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z", indicating when the fulfillment was picked up by the recipient.
The pickup [timestamp](workingwithdates) in RFC3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". For fulfillments with the schedule type `ASAP`, this is automatically set to the current time plus the expected duration to prepare the fulfillment. This represents the start of the pickup window.
The pickup window duration in RFC3339 duration format, e.g., "P1W3D". This duration represents the window of time for which the order should be picked up after the `pickup_at` time. Can be used as an informational guideline for merchants.
The [timestamp](workingwithdates) in RFC3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z", indicating when the fulfillment was placed.
The preparation time duration in RFC3339 duration format, e.g., "P1W3D". This duration indicates how long it takes the merchant to prepare this fulfillment.
The [timestamp](workingwithdates) in RFC3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z", indicating when the merchant set the fulfillment as ready for pickup.
The recipient of this pickup fulfillment.
The [timestamp](workingwithdates) in RFC3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z", indicating when the fulfillment was rejected.
The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`. See [OrderFulfillmentPickupDetailsScheduleType](type-orderfulfillmentpickupdetailsscheduletype) for possible values
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 65 def self.attribute_map { :'recipient' => :'recipient', :'expires_at' => :'expires_at', :'auto_complete_duration' => :'auto_complete_duration', :'schedule_type' => :'schedule_type', :'pickup_at' => :'pickup_at', :'pickup_window_duration' => :'pickup_window_duration', :'prep_time_duration' => :'prep_time_duration', :'note' => :'note', :'placed_at' => :'placed_at', :'accepted_at' => :'accepted_at', :'rejected_at' => :'rejected_at', :'ready_at' => :'ready_at', :'expired_at' => :'expired_at', :'picked_up_at' => :'picked_up_at', :'canceled_at' => :'canceled_at', :'cancel_reason' => :'cancel_reason' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 110 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?(:'recipient') self.recipient = attributes[:'recipient'] end if attributes.has_key?(:'expires_at') self.expires_at = attributes[:'expires_at'] end if attributes.has_key?(:'auto_complete_duration') self.auto_complete_duration = attributes[:'auto_complete_duration'] end if attributes.has_key?(:'schedule_type') self.schedule_type = attributes[:'schedule_type'] end if attributes.has_key?(:'pickup_at') self.pickup_at = attributes[:'pickup_at'] end if attributes.has_key?(:'pickup_window_duration') self.pickup_window_duration = attributes[:'pickup_window_duration'] end if attributes.has_key?(:'prep_time_duration') self.prep_time_duration = attributes[:'prep_time_duration'] end if attributes.has_key?(:'note') self.note = attributes[:'note'] end if attributes.has_key?(:'placed_at') self.placed_at = attributes[:'placed_at'] end if attributes.has_key?(:'accepted_at') self.accepted_at = attributes[:'accepted_at'] end if attributes.has_key?(:'rejected_at') self.rejected_at = attributes[:'rejected_at'] end if attributes.has_key?(:'ready_at') self.ready_at = attributes[:'ready_at'] end if attributes.has_key?(:'expired_at') self.expired_at = attributes[:'expired_at'] end if attributes.has_key?(:'picked_up_at') self.picked_up_at = attributes[:'picked_up_at'] end if attributes.has_key?(:'canceled_at') self.canceled_at = attributes[:'canceled_at'] end if attributes.has_key?(:'cancel_reason') self.cancel_reason = attributes[:'cancel_reason'] end end
Attribute type mapping.
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 87 def self.swagger_types { :'recipient' => :'OrderFulfillmentRecipient', :'expires_at' => :'String', :'auto_complete_duration' => :'String', :'schedule_type' => :'String', :'pickup_at' => :'String', :'pickup_window_duration' => :'String', :'prep_time_duration' => :'String', :'note' => :'String', :'placed_at' => :'String', :'accepted_at' => :'String', :'rejected_at' => :'String', :'ready_at' => :'String', :'expired_at' => :'String', :'picked_up_at' => :'String', :'canceled_at' => :'String', :'cancel_reason' => :'String' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 229 def ==(o) return true if self.equal?(o) self.class == o.class && recipient == o.recipient && expires_at == o.expires_at && auto_complete_duration == o.auto_complete_duration && schedule_type == o.schedule_type && pickup_at == o.pickup_at && pickup_window_duration == o.pickup_window_duration && prep_time_duration == o.prep_time_duration && note == o.note && placed_at == o.placed_at && accepted_at == o.accepted_at && rejected_at == o.rejected_at && ready_at == o.ready_at && expired_at == o.expired_at && picked_up_at == o.picked_up_at && canceled_at == o.canceled_at && cancel_reason == o.cancel_reason 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/square_connect/models/order_fulfillment_pickup_details.rb, line 286 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 =~ /\A(true|t|yes|y|1)\z/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 = SquareConnect.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/square_connect/models/order_fulfillment_pickup_details.rb, line 352 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/square_connect/models/order_fulfillment_pickup_details.rb, line 265 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/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
Custom attribute writer method with validation @param [Object] cancel_reason
Value to be assigned
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 218 def cancel_reason=(cancel_reason) if !cancel_reason.nil? && cancel_reason.to_s.length > 100 fail ArgumentError, "invalid value for 'cancel_reason', the character length must be smaller than or equal to 100." end @cancel_reason = cancel_reason end
@see the `==` method @param [Object] Object to be compared
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 252 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 258 def hash [recipient, expires_at, auto_complete_duration, schedule_type, pickup_at, pickup_window_duration, prep_time_duration, note, placed_at, accepted_at, rejected_at, ready_at, expired_at, picked_up_at, canceled_at, cancel_reason].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 184 def list_invalid_properties invalid_properties = Array.new if !@note.nil? && @note.to_s.length > 500 invalid_properties.push("invalid value for 'note', the character length must be smaller than or equal to 500.") end if !@cancel_reason.nil? && @cancel_reason.to_s.length > 100 invalid_properties.push("invalid value for 'cancel_reason', the character length must be smaller than or equal to 100.") end return invalid_properties end
Custom attribute writer method with validation @param [Object] note Value to be assigned
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 207 def note=(note) if !note.nil? && note.to_s.length > 500 fail ArgumentError, "invalid value for 'note', the character length must be smaller than or equal to 500." end @note = note end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/square_connect/models/order_fulfillment_pickup_details.rb, line 338 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/square_connect/models/order_fulfillment_pickup_details.rb, line 326 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/square_connect/models/order_fulfillment_pickup_details.rb, line 199 def valid? return false if !@note.nil? && @note.to_s.length > 500 return false if !@cancel_reason.nil? && @cancel_reason.to_s.length > 100 return true end