Class: WebPay::BasicListRequest

Inherits:
Entity
  • Object
show all
Defined in:
lib/webpay/data_types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#normalize_hash, #to_h, #to_s

Constructor Details

#initialize(hash = {}) ⇒ BasicListRequest

Returns a new instance of BasicListRequest.



1083
1084
1085
1086
1087
# File 'lib/webpay/data_types.rb', line 1083

def initialize(hash = {})
  hash = normalize_hash(hash)
  hash['created'] = hash['created'].is_a?(Hash) ? WebPay::CreatedRange.new(hash['created']) : hash['created']
  @attributes = hash
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



1066
1067
1068
# File 'lib/webpay/data_types.rb', line 1066

def attributes
  @attributes
end

Class Method Details

.create(params) ⇒ Object



1073
1074
1075
1076
1077
1078
1079
1080
1081
# File 'lib/webpay/data_types.rb', line 1073

def self.create(params)
  return params if params.is_a?(self)
  hash = case params
    when Hash; params
    else
      raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
    end
  self.new(hash)
end

.fieldsObject



1068
1069
1070
# File 'lib/webpay/data_types.rb', line 1068

def self.fields
  ['count', 'offset', 'created']
end

Instance Method Details

#countObject

attributes accessors



1105
1106
1107
# File 'lib/webpay/data_types.rb', line 1105

def count
  attributes['count']
end

#count=(value) ⇒ Object



1109
1110
1111
# File 'lib/webpay/data_types.rb', line 1109

def count=(value)
  attributes['count'] = value
end

#createdObject



1121
1122
1123
# File 'lib/webpay/data_types.rb', line 1121

def created
  attributes['created']
end

#created=(value) ⇒ Object



1125
1126
1127
1128
# File 'lib/webpay/data_types.rb', line 1125

def created=(value)
  value = value.is_a?(Hash) ? WebPay::CreatedRange.new(value) : value
  attributes['created'] = value
end

#offsetObject



1113
1114
1115
# File 'lib/webpay/data_types.rb', line 1113

def offset
  attributes['offset']
end

#offset=(value) ⇒ Object



1117
1118
1119
# File 'lib/webpay/data_types.rb', line 1117

def offset=(value)
  attributes['offset'] = value
end

#query_paramsObject



1095
1096
1097
1098
1099
1100
1101
# File 'lib/webpay/data_types.rb', line 1095

def query_params
  result = {}
  copy_if_exists(@attributes, result, 'count', 'query_params');
  copy_if_exists(@attributes, result, 'offset', 'query_params');
  copy_if_exists(@attributes, result, 'created', 'query_params');
  return result
end

#request_bodyObject



1090
1091
1092
1093
# File 'lib/webpay/data_types.rb', line 1090

def request_body
  result = {}
  result
end