jsb_client 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsb.rb +37 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5ff659beedf72c51ea60cf20c6c3dfd3d4e66bb
|
4
|
+
data.tar.gz: 204db055e97d4b5878f0305c3b987dace177a4f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 728df59908ad6c8b94bda3e7f93093723304c57540379d7a54c6aab956cee1e2833aa33c742c3417677edcc04d234fb04905c5c6bf13fa3621a7957073fc61c2
|
7
|
+
data.tar.gz: 593a2ab6e76286cbdf86250e3a54618d0517c59596222fca96a2ef4f9259351eb4a34921149a8fe2258d88cb4b9c71c5fcf71ebdf816adfac8adac37bf8b9ca9
|
data/lib/jsb.rb
CHANGED
@@ -16,6 +16,7 @@ class JSB
|
|
16
16
|
@api_key = api_key
|
17
17
|
@headers = { :"JSB-Api-Key" => api_key }
|
18
18
|
@statistics = JSB::Statistics.new(self)
|
19
|
+
@apps = JSB::Apps.new(self)
|
19
20
|
|
20
21
|
@api = RestClient::Resource.new(API_URL, :content_type => "application/json", :headers => @headers)
|
21
22
|
end
|
@@ -82,6 +83,26 @@ class JSB
|
|
82
83
|
parse(@api["/journals/#{journal_id}/authors"].get(:accept => :json))
|
83
84
|
end
|
84
85
|
|
86
|
+
def journal_apps(journal_id)
|
87
|
+
parse(@api["/journals/#{journal_id}/apps"].get(:accept => :json))
|
88
|
+
end
|
89
|
+
|
90
|
+
def journal_app(journal_id, app_id)
|
91
|
+
parse(@api["/journals/#{journal_id}/apps/#{app_id}"].get(:accept => :json))
|
92
|
+
end
|
93
|
+
|
94
|
+
def journal_install_app(journal_id, app_id)
|
95
|
+
parse(@api["/journals/#{journal_id}/apps/#{app_id}"].put(:accept => :json))
|
96
|
+
end
|
97
|
+
|
98
|
+
def journal_uninstall_app(journal_id, app_id)
|
99
|
+
parse(@api["/journals/#{journal_id}/apps/#{app_id}"].delete(:accept => :json))
|
100
|
+
end
|
101
|
+
|
102
|
+
def create_journal(site, xml)
|
103
|
+
parse(@api["/journals"].post(:site => site, :xml => xml, :accept => :json))
|
104
|
+
end
|
105
|
+
|
85
106
|
# Return a list of articles from author.
|
86
107
|
#
|
87
108
|
# Arguments:
|
@@ -148,4 +169,20 @@ class JSB
|
|
148
169
|
end
|
149
170
|
end
|
150
171
|
|
172
|
+
class Apps
|
173
|
+
|
174
|
+
def initialize(parent)
|
175
|
+
@parent = parent
|
176
|
+
end
|
177
|
+
|
178
|
+
def all
|
179
|
+
@parent.api["/apps"].get :accept => :json
|
180
|
+
end
|
181
|
+
|
182
|
+
def app(app_id)
|
183
|
+
@parent.api["/apps/#{app_id}"].get :accept => :json
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
151
188
|
end
|