Class: WebPay::EventListRequest

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 = {}) ⇒ EventListRequest

Returns a new instance of EventListRequest.



1470
1471
1472
1473
1474
# File 'lib/webpay/data_types.rb', line 1470

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.



1453
1454
1455
# File 'lib/webpay/data_types.rb', line 1453

def attributes
  @attributes
end

Class Method Details

.create(params) ⇒ Object



1460
1461
1462
1463
1464
1465
1466
1467
1468
# File 'lib/webpay/data_types.rb', line 1460

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



1455
1456
1457
# File 'lib/webpay/data_types.rb', line 1455

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

Instance Method Details

#countObject

attributes accessors



1494
1495
1496
# File 'lib/webpay/data_types.rb', line 1494

def count
  attributes['count']
end

#count=(value) ⇒ Object



1498
1499
1500
# File 'lib/webpay/data_types.rb', line 1498

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

#createdObject



1510
1511
1512
# File 'lib/webpay/data_types.rb', line 1510

def created
  attributes['created']
end

#created=(value) ⇒ Object



1514
1515
1516
1517
# File 'lib/webpay/data_types.rb', line 1514

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

#offsetObject



1502
1503
1504
# File 'lib/webpay/data_types.rb', line 1502

def offset
  attributes['offset']
end

#offset=(value) ⇒ Object



1506
1507
1508
# File 'lib/webpay/data_types.rb', line 1506

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

#query_paramsObject



1482
1483
1484
1485
1486
1487
1488
1489
1490
# File 'lib/webpay/data_types.rb', line 1482

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');
  copy_if_exists(@attributes, result, 'type', 'query_params');
  copy_if_exists(@attributes, result, 'shop', 'query_params');
  return result
end

#request_bodyObject



1477
1478
1479
1480
# File 'lib/webpay/data_types.rb', line 1477

def request_body
  result = {}
  result
end

#shopObject



1527
1528
1529
# File 'lib/webpay/data_types.rb', line 1527

def shop
  attributes['shop']
end

#shop=(value) ⇒ Object



1531
1532
1533
# File 'lib/webpay/data_types.rb', line 1531

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

#typeObject



1519
1520
1521
# File 'lib/webpay/data_types.rb', line 1519

def type
  attributes['type']
end

#type=(value) ⇒ Object



1523
1524
1525
# File 'lib/webpay/data_types.rb', line 1523

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