telegraph-ruby 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc7b3a982e5505fc92b94a0c2a829d4f74e58695
4
- data.tar.gz: bd4bb1307a98a3711adeb2b7b1fe90bce30d11e6
3
+ metadata.gz: b71484a0bf34b0b632cb5c6f0f73551733e80367
4
+ data.tar.gz: b67d02a7378ba04685361989510705c175ee2dbf
5
5
  SHA512:
6
- metadata.gz: 82a86e21f55d88c9aa734923e5214cf2673179153499bb1a3a3d2b5c06e2d8d2d198112c0bc67e5def43613d027e40dde6f0690a362fe06707ba1a04b059838d
7
- data.tar.gz: aea02b31ded2c5dc5ca80a3012467086b17b621640a452851f76fcb8826e414195e97e1a3b0bca4cff7d0eaf12230c6e2ed323163d5a77ba4cffa65d627d81fa
6
+ metadata.gz: b18ca1aa9c12afd4915dd73b0ce67b4f9b697ebdb8b9597cf0397dd7f554398b30ba3daaba9f7fb8e35fbe77481caa2d5bf7249c96063209b7ab6d1a354a410e
7
+ data.tar.gz: 5a819f05542ea6486275bcdf734dbbc45cabcc9a2a1b4689918fa76fcc65929409e4d03eca4eb91add5f13792747f9ba937be5676d5b7828dba259074a13e6b2
data/README.md CHANGED
@@ -32,6 +32,64 @@ require 'telegraph-ruby'
32
32
 
33
33
  telegraph = Telegraph.new
34
34
  ```
35
+
36
+ ## Methods
37
+
38
+ #### [.createAccount](http://telegra.ph/api#createAccount)
39
+ ```ruby
40
+ telegraph.createAccount(short_name:"cos404")
41
+ #=> {"short_name"=>"cos404", "author_name"=>"", "author_url"=>"", "access_token"=>"e585e79dd4c296228d2a42da1d7c8d0ed18d697d54be5918a4c3a8de88f1","auth_url"=>"https://edit.telegra.ph/auth/Sr5fCg0GUH8Zlx7AzKJAEljgsXcyyBSo2WBCaCh5hp"}
42
+ ```
43
+
44
+ #### [.editAccountInfo](http://telegra.ph/api#editAccountInfo)
45
+ ```ruby
46
+ telegraph.editAccountInfo(access_token:'e585e79dd4c296228d2a42da1d7c8d0ed18d697d54be5918a4c3a8de88f1', short_name:'cosmos404')
47
+ #=> {"short_name"=>"cosmos404", "author_name"=>"", "author_url"=>""}
48
+ ```
49
+
50
+ #### [.getAccountInfo](http://telegra.ph/api#getAccountInfo)
51
+ ```ruby
52
+ telegraph.getAccountInfo(access_token:'e585e79dd4c296228d2a42da1d7c8d0ed18d697d54be5918a4c3a8de88f1')
53
+ #=> {"short_name"=>"cosmos404", "author_name"=>"", "author_url"=>""}
54
+ ```
55
+
56
+ #### [.revokeAccessToken](http://telegra.ph/api#revokeAccessToken)
57
+ ```ruby
58
+ telegraph.revokeAccessToken(access_token:'e585e79dd4c296228d2a42da1d7c8d0ed18d697d54be5918a4c3a8de88f1')
59
+ #=> {"access_token"=>"4061ba937126ca4928ce1fd468d96953df288d205acbc6a8105a14f32747", "auth_url"=>"https://edit.telegra.ph/auth/6kKW5aur5ebJm8s61mWGEwuolWgRbxlfP69UeElhQv"}
60
+ ```
61
+
62
+ #### [.createPage](http://telegra.ph/api#createPage)
63
+ ```ruby
64
+ telegraph.createPage(access_token:'4061ba937126ca4928ce1fd468d96953df288d205acbc6a8105a14f32747', title:'telegraph-ruby', content:'[{"tag":"figure","children":[{"tag":"img","attrs":{"src":"http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg"}},{"tag":"figcaption","children":[""]}]},{"tag":"p", "children":["A Ruby interface to [Telegra.ph API]"]}]')
65
+ #=> {"path"=>"telegraph-ruby-09-28", "url"=>"http://telegra.ph/telegraph-ruby-09-28", "title"=>"telegraph-ruby", "description"=>"", "views"=>0, "can_edit"=>true}
66
+ ```
67
+
68
+ #### [.editPage](http://telegra.ph/api#editPage)
69
+ ```ruby
70
+ telegraph.editPage(access_token:'4061ba937126ca4928ce1fd468d96953df288d205acbc6a8105a14f32747', path:'telegraph-ruby-09-28', author_name:'@cosmos404', author_url:'https://t.me/cosmos404', title:'telegraph-ruby', content:'[{"tag":"figure","children":[{"tag":"img","attrs":{"src":"http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg"}},{"tag":"figcaption","children":[""]}]},{"tag":"p", "children":["A Ruby interface to [Telegra.ph API]"]}]')
71
+ #=> {"path"=>"telegraph-ruby-09-28", "url"=>"http://telegra.ph/telegraph-ruby-09-28", "title"=>"telegraph-ruby", "description"=>"", "author_name"=>"@cosmos404", "author_url"=>"https://t.me/cosmos404", "views"=>0, "can_edit"=>true}
72
+ ```
73
+
74
+
75
+ #### [.getPage](http://telegra.ph/api#getPage)
76
+ ```ruby
77
+ telegraph.getPage(path:'telegraph-ruby-09-28')
78
+ #=> {"path"=>"telegraph-ruby-09-28", "url"=>"http://telegra.ph/telegraph-ruby-09-28", "title"=>"telegraph-ruby", "description"=>"A Ruby interface to [Telegra.ph API]", "author_name"=>"@cosmos404", "author_url"=>"https://t.me/cosmos404", "image_url"=>"http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg", "views"=>2}
79
+ ```
80
+
81
+ #### [.getPageList](http://telegra.ph/api#getPageList)
82
+ ```ruby
83
+ telegraph.getPageList(access_token:'4061ba937126ca4928ce1fd468d96953df288d205acbc6a8105a14f32747')
84
+ #=> {"total_count"=>1, "pages"=>[{"path"=>"telegraph-ruby-09-28", "url"=>"http://telegra.ph/telegraph-ruby-09-28", "title"=>"telegraph-ruby", "description"=>"A Ruby interface to [Telegra.ph API]", "author_name"=>"@cosmos404", "author_url"=>"https://t.me/cosmos404", "image_url"=>"http://telegra.ph/file/6a5b15e7eb4d7329ca7af.jpg", "views"=>2, "can_edit"=>true}]}
85
+ ```
86
+
87
+ #### [.getViews](http://telegra.ph/api#getViews)
88
+ ```ruby
89
+ telegraph.getViews(path:'telegraph-ruby-09-28')
90
+ #=> {"views"=>2}
91
+ ```
92
+
35
93
  ## Contributing
36
94
 
37
95
  1. Fork it
@@ -3,7 +3,7 @@ require 'httparty'
3
3
  module Request
4
4
  def post(method, query)
5
5
  data = HTTParty.post("https://api.telegra.ph/#{method}", query: query).parsed_response
6
- data['result'] if data['result']
6
+ return data['result'] if data['result']
7
7
  data
8
8
  end
9
9
  end
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'telegraph-ruby'
6
- spec.version = '0.1.0'
6
+ spec.version = '0.1.1'
7
7
  spec.authors = ['Maxim Hvaschinsky']
8
8
  spec.email = ['22division7@gmail.com']
9
9
  spec.date = '2017-09-27'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegraph-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Hvaschinsky