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.



1166
1167
1168
1169
1170
# File 'lib/webpay/data_types.rb', line 1166

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.



1149
1150
1151
# File 'lib/webpay/data_types.rb', line 1149

def attributes
  @attributes
end

Class Method Details

.create(params) ⇒ Object



1156
1157
1158
1159
1160
1161
1162
1163
1164
# File 'lib/webpay/data_types.rb', line 1156

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



1151
1152
1153
# File 'lib/webpay/data_types.rb', line 1151

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

Instance Method Details

#countObject

attributes accessors



1188
1189
1190
# File 'lib/webpay/data_types.rb', line 1188

def count
  attributes['count']
end

#count=(value) ⇒ Object



1192
1193
1194
# File 'lib/webpay/data_types.rb', line 1192

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

#createdObject



1204
1205
1206
# File 'lib/webpay/data_types.rb', line 1204

def created
  attributes['created']
end

#created=(value) ⇒ Object



1208
1209
1210
1211
# File 'lib/webpay/data_types.rb', line 1208

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

#offsetObject



1196
1197
1198
# File 'lib/webpay/data_types.rb', line 1196

def offset
  attributes['offset']
end

#offset=(value) ⇒ Object



1200
1201
1202
# File 'lib/webpay/data_types.rb', line 1200

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

#query_paramsObject



1178
1179
1180
1181
1182
1183
1184
# File 'lib/webpay/data_types.rb', line 1178

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



1173
1174
1175
1176
# File 'lib/webpay/data_types.rb', line 1173

def request_body
  result = {}
  result
end