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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jsb.rb +37 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2ee197f313699330dce45764f71184071c63e15
4
- data.tar.gz: 256a26f36683fbea3680ce2dd2c69c8b9229b681
3
+ metadata.gz: a5ff659beedf72c51ea60cf20c6c3dfd3d4e66bb
4
+ data.tar.gz: 204db055e97d4b5878f0305c3b987dace177a4f0
5
5
  SHA512:
6
- metadata.gz: b779fd113f704fb2c88aa2c1e93c2a63c062de757048dcd7e8a918e8a12103b3a3eb83e9d08f43cf0b0edf0125b8eb39bad1cfd44dd1f6d903d25a9320e75fd2
7
- data.tar.gz: 9ba7a0bde5b70062287a3937e2001f1e6644c8f1c7bebbfdfe079866495b39da4a618869a79ab65dc5e683d7760bd34d91f6adeceded427290c0c3324fbf5024
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsb_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Definity Solutions