Sha256: 55394d4942bf3ca778e3b31c1834b452cac9f38233cd06c48df041d991157c6c
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
module Telegraph module Page def self.create(params) return nil unless CreatePageSchema.(params).success? response = Telegraph::Core.request('createPage', params) if response.dig('result', 'content') response['result']['content'] = Types::Page.new(Hashie.symbolize_keys response['result']) end response end def self.edit(params) return nil unless EditPageSchema.(params).success? path = params.delete(:path) response = Telegraph::Core.request('editPage/' + path, params) if response.dig('result', 'content') response['result']['content'] = Types::Page.new(Hashie.symbolize_keys response['result']) end response end def self.get(params) return nil unless GetPageSchema.(params).success? path = params.delete(:path) response = Telegraph::Core.request('getPage/' + path, params) Types::Page.new(Hashie.symbolize_keys response['result']) end def self.list(params) return nil unless GetPageListSchema.(params).success? response = Telegraph::Core.request('getPageList', params) Types::PageList.new(Hashie.symbolize_keys response['result']) end def self.views(params) return nil unless GetViewsSchema.(params).success? path = params.delete(:path) response = Telegraph::Core.request('getViews/' + path, params) Types::PageViews.new(Hashie.symbolize_keys response['result']) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
telegraph_api-0.1.1 | lib/telegraph/api/page.rb |
telegraph_api-0.1.0 | lib/telegraph/api/page.rb |