Class: EasyPost::Insurance

Inherits:
Resource show all
Defined in:
lib/easypost/insurance.rb

Overview

An Insurance object represents insurance for packages purchased both via the EasyPost API as well as shipments purchased through third parties and later registered with EasyPost.

Instance Attribute Summary

Attributes inherited from EasyPostObject

#api_key, #name, #parent, #unsaved_values

Class Method Summary collapse

Methods inherited from Resource

all, class_name, create, #delete, each, get_next_page_exec, #refresh, retrieve, #save, url, #url

Methods inherited from EasyPostObject

#[], #[]=, #as_json, construct_from, #deconstruct_keys, #each, #id, #id=, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from EasyPost::EasyPostObject

Class Method Details

.build_next_page_params(_collection, current_page_items, page_size = nil) ⇒ Object

Build the next page parameters.



12
13
14
15
16
17
18
19
# File 'lib/easypost/insurance.rb', line 12

def self.build_next_page_params(_collection, current_page_items, page_size = nil)
  params = {}
  params[:before_id] = current_page_items.last.id
  unless page_size.nil?
    params[:page_size] = page_size
  end
  params
end

.get_next_page(collection, page_size = nil) ⇒ Object

Get the next page of insurances.



7
8
9
# File 'lib/easypost/insurance.rb', line 7

def self.get_next_page(collection, page_size = nil)
  get_next_page_exec(method(:all), collection, collection.insurances, page_size)
end