Class: ApolloDeploySignalSdkRails::PageInfo
- Inherits:
-
Object
- Object
- ApolloDeploySignalSdkRails::PageInfo
- Defined in:
- lib/apollo_deploy_signal_sdk_rails/types.rb
Overview
Schema type: PageInfo
Instance Attribute Summary collapse
- #has_next_page ⇒ Boolean
- #has_previous_page ⇒ Boolean
- #page ⇒ Integer
- #size ⇒ Integer
- #total ⇒ Integer
- #total_pages ⇒ Integer
Class Method Summary collapse
-
.from_json(attributes) ⇒ PageInfo
Create an instance from a parsed JSON hash.
Instance Method Summary collapse
-
#initialize(page:, size:, total:, total_pages:, has_next_page:, has_previous_page:) ⇒ PageInfo
constructor
A new instance of PageInfo.
-
#to_h ⇒ Hash
A hash representation of this object.
Constructor Details
#initialize(page:, size:, total:, total_pages:, has_next_page:, has_previous_page:) ⇒ PageInfo
Returns a new instance of PageInfo.
1713 1714 1715 1716 1717 1718 1719 1720 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1713 def initialize(page: , size: , total: , total_pages: , has_next_page: , has_previous_page: ) @page = page @size = size @total = total @total_pages = total_pages @has_next_page = has_next_page @has_previous_page = has_previous_page end |
Instance Attribute Details
#has_next_page ⇒ Boolean
1708 1709 1710 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1708 def has_next_page @has_next_page end |
#has_previous_page ⇒ Boolean
1710 1711 1712 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1710 def has_previous_page @has_previous_page end |
#page ⇒ Integer
1700 1701 1702 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1700 def page @page end |
#size ⇒ Integer
1702 1703 1704 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1702 def size @size end |
#total ⇒ Integer
1704 1705 1706 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1704 def total @total end |
#total_pages ⇒ Integer
1706 1707 1708 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1706 def total_pages @total_pages end |
Class Method Details
.from_json(attributes) ⇒ PageInfo
Create an instance from a parsed JSON hash.
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1737 def self.from_json(attributes) return nil unless attributes.is_a?(Hash) new( page: attributes.key?("page") ? attributes["page"] : attributes[:page], size: attributes.key?("size") ? attributes["size"] : attributes[:size], total: attributes.key?("total") ? attributes["total"] : attributes[:total], total_pages: attributes.key?("totalPages") ? attributes["totalPages"] : attributes[:total_pages], has_next_page: attributes.key?("hasNextPage") ? attributes["hasNextPage"] : attributes[:has_next_page], has_previous_page: attributes.key?("hasPreviousPage") ? attributes["hasPreviousPage"] : attributes[:has_previous_page], ) end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of this object.
1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 |
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 1723 def to_h { page: @page, size: @size, total: @total, total_pages: @total_pages, has_next_page: @has_next_page, has_previous_page: @has_previous_page, }.compact end |