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.



1535
1536
1537
1538
1539
# File 'lib/webpay/data_types.rb', line 1535

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.



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

def attributes
  @attributes
end

Class Method Details

.create(params) ⇒ Object



1525
1526
1527
1528
1529
1530
1531
1532
1533
# File 'lib/webpay/data_types.rb', line 1525

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



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

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

Instance Method Details

#countObject

attributes accessors



1559
1560
1561
# File 'lib/webpay/data_types.rb', line 1559

def count
  attributes['count']
end

#count=(value) ⇒ Object



1563
1564
1565
# File 'lib/webpay/data_types.rb', line 1563

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

#createdObject



1575
1576
1577
# File 'lib/webpay/data_types.rb', line 1575

def created
  attributes['created']
end

#created=(value) ⇒ Object



1579
1580
1581
1582
# File 'lib/webpay/data_types.rb', line 1579

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

#offsetObject



1567
1568
1569
# File 'lib/webpay/data_types.rb', line 1567

def offset
  attributes['offset']
end

#offset=(value) ⇒ Object



1571
1572
1573
# File 'lib/webpay/data_types.rb', line 1571

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

#query_paramsObject



1547
1548
1549
1550
1551
1552
1553
1554
1555
# File 'lib/webpay/data_types.rb', line 1547

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



1542
1543
1544
1545
# File 'lib/webpay/data_types.rb', line 1542

def request_body
  result = {}
  result
end

#shopObject



1592
1593
1594
# File 'lib/webpay/data_types.rb', line 1592

def shop
  attributes['shop']
end

#shop=(value) ⇒ Object



1596
1597
1598
# File 'lib/webpay/data_types.rb', line 1596

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

#typeObject



1584
1585
1586
# File 'lib/webpay/data_types.rb', line 1584

def type
  attributes['type']
end

#type=(value) ⇒ Object



1588
1589
1590
# File 'lib/webpay/data_types.rb', line 1588

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