Class: SK::SDK::Base::SkCollection
- Inherits:
-
ActiveResource::Collection
- Object
- ActiveResource::Collection
- SK::SDK::Base::SkCollection
- Defined in:
- lib/sk_sdk/base.rb
Instance Attribute Summary collapse
-
#current_page ⇒ Object
Returns the value of attribute current_page.
-
#next_url ⇒ Object
Returns the value of attribute next_url.
-
#per_page ⇒ Object
Returns the value of attribute per_page.
-
#prev_url ⇒ Object
Returns the value of attribute prev_url.
-
#self_url ⇒ Object
Returns the value of attribute self_url.
-
#total_entries ⇒ Object
Returns the value of attribute total_entries.
-
#total_pages ⇒ Object
Returns the value of attribute total_pages.
Instance Method Summary collapse
-
#initialize(parsed = {}, element_name = nil) ⇒ SkCollection
constructor
A new instance of SkCollection.
Constructor Details
#initialize(parsed = {}, element_name = nil) ⇒ SkCollection
Returns a new instance of SkCollection.
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/sk_sdk/base.rb', line 80 def initialize(parsed = {}, element_name = nil) @elements = element_name.present? ? parsed[element_name] : parsed %w(current_page per_page total_entries total_pages).each do |collection_info| instance_variable_set(:"@#{collection_info}", parsed['collection'][collection_info]) end %w(next self prev).each do |link_info| instance_variable_set(:"@#{link_info}_url", parsed['links'][link_info]) end @next_page = parsed['next_page'] end |
Instance Attribute Details
#current_page ⇒ Object
Returns the value of attribute current_page.
76 77 78 |
# File 'lib/sk_sdk/base.rb', line 76 def current_page @current_page end |
#next_url ⇒ Object
Returns the value of attribute next_url.
78 79 80 |
# File 'lib/sk_sdk/base.rb', line 78 def next_url @next_url end |
#per_page ⇒ Object
Returns the value of attribute per_page.
76 77 78 |
# File 'lib/sk_sdk/base.rb', line 76 def per_page @per_page end |
#prev_url ⇒ Object
Returns the value of attribute prev_url.
78 79 80 |
# File 'lib/sk_sdk/base.rb', line 78 def prev_url @prev_url end |
#self_url ⇒ Object
Returns the value of attribute self_url.
78 79 80 |
# File 'lib/sk_sdk/base.rb', line 78 def self_url @self_url end |
#total_entries ⇒ Object
Returns the value of attribute total_entries.
76 77 78 |
# File 'lib/sk_sdk/base.rb', line 76 def total_entries @total_entries end |
#total_pages ⇒ Object
Returns the value of attribute total_pages.
76 77 78 |
# File 'lib/sk_sdk/base.rb', line 76 def total_pages @total_pages end |