telegraph-ruby 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc7b3a982e5505fc92b94a0c2a829d4f74e58695
4
+ data.tar.gz: bd4bb1307a98a3711adeb2b7b1fe90bce30d11e6
5
+ SHA512:
6
+ metadata.gz: 82a86e21f55d88c9aa734923e5214cf2673179153499bb1a3a3d2b5c06e2d8d2d198112c0bc67e5def43613d027e40dde6f0690a362fe06707ba1a04b059838d
7
+ data.tar.gz: aea02b31ded2c5dc5ca80a3012467086b17b621640a452851f76fcb8826e414195e97e1a3b0bca4cff7d0eaf12230c6e2ed323163d5a77ba4cffa65d627d81fa
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ source "https://rubygems.org"
3
+
4
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+
6
+ gem 'httparty', '~> 0.14.0'
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # telegraph-ruby
2
+
3
+ A Ruby interface to [Telegra.ph API](http://telegra.ph/api).
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/telegraph-ruby.svg)](https://badge.fury.io/rb/telegraph-ruby)
6
+ [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/cos404)
7
+
8
+ ## Installation
9
+
10
+ Add following line to your Gemfile:
11
+
12
+ ```ruby
13
+ gem 'telegraph-ruby'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ ```shell
19
+ $ bundle
20
+ ```
21
+
22
+ Or install it system-wide:
23
+
24
+ ```shell
25
+ $ gem install telegraph-ruby
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```ruby
31
+ require 'telegraph-ruby'
32
+
33
+ telegraph = Telegraph.new
34
+ ```
35
+ ## Contributing
36
+
37
+ 1. Fork it
38
+ 2. Create your feature branch (git checkout -b my-new-feature)
39
+ 3. Commit your changes (git commit -am 'Add some feature')
40
+ 4. Push to the branch (git push origin my-new-feature)
41
+ 5. Create new Pull Request
data/lib/request.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'httparty'
2
+
3
+ module Request
4
+ def post(method, query)
5
+ data = HTTParty.post("https://api.telegra.ph/#{method}", query: query).parsed_response
6
+ data['result'] if data['result']
7
+ data
8
+ end
9
+ end
@@ -0,0 +1,50 @@
1
+ require "request.rb"
2
+
3
+ class Telegraph include Request
4
+
5
+ def createAccount(query)
6
+ method = 'createAccount'
7
+ post(method, query)
8
+ end
9
+
10
+ def createPage(query)
11
+ method = 'createPage'
12
+ post(method, query)
13
+ end
14
+
15
+ def editAccountInfo(query)
16
+ method = 'editAccountInfo'
17
+ post(method, query)
18
+ end
19
+
20
+ def editPage(query)
21
+ method = 'editPage'
22
+ post(method, query)
23
+ end
24
+
25
+ def getAccountInfo(query)
26
+ method = 'getAccountInfo'
27
+ post(method, query)
28
+ end
29
+
30
+ def getPage(query)
31
+ method = 'getPage'
32
+ post(method, query)
33
+ end
34
+
35
+ def getPageList(query)
36
+ method = 'getPageList'
37
+ post(method, query)
38
+ end
39
+
40
+ def getViews(query)
41
+ method = 'getViews'
42
+ post(method, query)
43
+ end
44
+
45
+ def revokeAccessToken(access_token)
46
+ method = 'revokeAccessToken'
47
+ post(method, access_token)
48
+ end
49
+
50
+ end
@@ -0,0 +1,14 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'telegraph-ruby'
6
+ spec.version = '0.1.0'
7
+ spec.authors = ['Maxim Hvaschinsky']
8
+ spec.email = ['22division7@gmail.com']
9
+ spec.date = '2017-09-27'
10
+ spec.summary = "A Ruby interface to Telegra.ph API"
11
+ spec.homepage = 'https://github.com/cos404/telegraph-ruby'
12
+ spec.files = `git ls-files`.split($/)
13
+ spec.license = 'MIT'
14
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: telegraph-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Maxim Hvaschinsky
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - 22division7@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - Gemfile.lock
23
+ - README.md
24
+ - lib/request.rb
25
+ - lib/telegraph-ruby.rb
26
+ - telegraph-ruby.gemspec
27
+ homepage: https://github.com/cos404/telegraph-ruby
28
+ licenses:
29
+ - MIT
30
+ metadata: {}
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project:
47
+ rubygems_version: 2.6.8
48
+ signing_key:
49
+ specification_version: 4
50
+ summary: A Ruby interface to Telegra.ph API
51
+ test_files: []