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.



1143
1144
1145
1146
1147
# File 'lib/webpay/data_types.rb', line 1143

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.



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

def attributes
  @attributes
end

Class Method Details

.create(params) ⇒ Object



1133
1134
1135
1136
1137
1138
1139
1140
1141
# File 'lib/webpay/data_types.rb', line 1133

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



1128
1129
1130
# File 'lib/webpay/data_types.rb', line 1128

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

Instance Method Details

#countObject

attributes accessors



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

def count
  attributes['count']
end

#count=(value) ⇒ Object



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

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

#createdObject



1186
1187
1188
# File 'lib/webpay/data_types.rb', line 1186

def created
  attributes['created']
end

#created=(value) ⇒ Object



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

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

#offsetObject



1177
1178
1179
# File 'lib/webpay/data_types.rb', line 1177

def offset
  attributes['offset']
end

#offset=(value) ⇒ Object



1182
1183
1184
# File 'lib/webpay/data_types.rb', line 1182

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

#query_paramsObject



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

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



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

def request_body
  result = {}
  result
end