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.



1554
1555
1556
1557
1558
# File 'lib/webpay/data_types.rb', line 1554

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.



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

def attributes
  @attributes
end

Class Method Details

.create(params) ⇒ Object



1544
1545
1546
1547
1548
1549
1550
1551
1552
# File 'lib/webpay/data_types.rb', line 1544

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



1539
1540
1541
# File 'lib/webpay/data_types.rb', line 1539

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

Instance Method Details

#countObject

attributes accessors



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

def count
  attributes['count']
end

#count=(value) ⇒ Object



1582
1583
1584
# File 'lib/webpay/data_types.rb', line 1582

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

#createdObject



1594
1595
1596
# File 'lib/webpay/data_types.rb', line 1594

def created
  attributes['created']
end

#created=(value) ⇒ Object



1598
1599
1600
1601
# File 'lib/webpay/data_types.rb', line 1598

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

#offsetObject



1586
1587
1588
# File 'lib/webpay/data_types.rb', line 1586

def offset
  attributes['offset']
end

#offset=(value) ⇒ Object



1590
1591
1592
# File 'lib/webpay/data_types.rb', line 1590

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

#query_paramsObject



1566
1567
1568
1569
1570
1571
1572
1573
1574
# File 'lib/webpay/data_types.rb', line 1566

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



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

def request_body
  result = {}
  result
end

#shopObject



1611
1612
1613
# File 'lib/webpay/data_types.rb', line 1611

def shop
  attributes['shop']
end

#shop=(value) ⇒ Object



1615
1616
1617
# File 'lib/webpay/data_types.rb', line 1615

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

#typeObject



1603
1604
1605
# File 'lib/webpay/data_types.rb', line 1603

def type
  attributes['type']
end

#type=(value) ⇒ Object



1607
1608
1609
# File 'lib/webpay/data_types.rb', line 1607

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