Class: PortaText::Command::Api::Destinations
- Defined in:
- lib/portatext/command/api/destinations.rb
Overview
The destinations endpoint. github.com/PortaText/docs/wiki/REST-API#api_destinations
- Author
-
Marcelo Gornstein ([email protected])
- Copyright
-
Copyright © 2015 PortaText
- License
-
Apache-2.0
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#endpoint(_method) ⇒ Object
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize.
- #page(page) ⇒ Object
- #save_to(file) ⇒ Object
- #sort_by(sort_by, order) ⇒ Object
Methods inherited from Base
#accept_content_type, #body, #content_type, #delete, #get, #initialize, #patch, #post, #put, #set
Constructor Details
This class inherits a constructor from PortaText::Command::Base
Instance Method Details
#endpoint(_method) ⇒ Object
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/portatext/command/api/destinations.rb', line 26 def endpoint(_method) qs = {} unless @args[:page].nil? qs['page'] = @args[:page] @args.delete :page end unless @args[:sort_by].nil? qs['sort_by'] = @args[:sort_by] @args.delete :sort_by end unless @args[:order].nil? qs['order'] = @args[:order] @args.delete :order end return "destinations?#{URI.encode_www_form qs}" unless qs.empty? 'destinations' end |
#page(page) ⇒ Object
11 12 13 |
# File 'lib/portatext/command/api/destinations.rb', line 11 def page(page) set :page, page end |
#save_to(file) ⇒ Object
20 21 22 |
# File 'lib/portatext/command/api/destinations.rb', line 20 def save_to(file) set :accept_file, file end |
#sort_by(sort_by, order) ⇒ Object
15 16 17 18 |
# File 'lib/portatext/command/api/destinations.rb', line 15 def sort_by(sort_by, order) set :sort_by, sort_by set :order, order end |