class Uktt::Chapter
A Chapter
object for dealing with an API resource
Attributes
chapter_id[RW]
config[RW]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/uktt/chapter.rb, line 6 def initialize(opts = {}) @chapter_id = opts[:chapter_id] || nil Uktt.configure(opts) @config = Uktt.config end
Public Instance Methods
changes()
click to toggle source
# File lib/uktt/chapter.rb, line 28 def changes return '@chapter_id cannot be nil' if @chapter_id.nil? fetch "#{CHAPTER}/#{@chapter_id}/changes.json" end
config=(new_opts = {})
click to toggle source
# File lib/uktt/chapter.rb, line 40 def config=(new_opts = {}) merged_opts = Uktt.config.merge(new_opts) Uktt.configure merged_opts @chapter_id = merged_opts[:chapter_id] || @chapter_id @config = Uktt.config end
goods_nomenclatures()
click to toggle source
# File lib/uktt/chapter.rb, line 22 def goods_nomenclatures return '@chapter_id cannot be nil' if @chapter_id.nil? fetch "#{GOODS_NOMENCLATURE}/chapter/#{@chapter_id}.json" end
note()
click to toggle source
# File lib/uktt/chapter.rb, line 34 def note return '@chapter_id cannot be nil' if @chapter_id.nil? fetch "#{CHAPTER}/#{@chapter_id}/chapter_note.json" end
retrieve()
click to toggle source
# File lib/uktt/chapter.rb, line 12 def retrieve return '@chapter_id cannot be nil' if @chapter_id.nil? fetch "#{CHAPTER}/#{@chapter_id}.json" end
retrieve_all()
click to toggle source
# File lib/uktt/chapter.rb, line 18 def retrieve_all fetch "#{CHAPTER}.json" end
Private Instance Methods
fetch(resource)
click to toggle source
# File lib/uktt/chapter.rb, line 49 def fetch(resource) Uktt::Http.new(@config[:host], @config[:version], @config[:debug]) .retrieve(resource, @config[:return_json]) end