officepod 0.1.3 → 0.1.4
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 +4 -4
- data/lib/officepod/authentication.rb +4 -4
- data/lib/officepod/bookmark.rb +2 -2
- data/lib/officepod/file.rb +2 -2
- data/lib/officepod/room.rb +2 -2
- data/lib/officepod/storage.rb +3 -3
- data/lib/officepod/version.rb +1 -1
- data/lib/officepod.rb +21 -17
- data/spec/officepod_spec.rb +24 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dc250293cdb6eb462abcf93ffce5471abad7200
|
4
|
+
data.tar.gz: e47f0c29771c73d0f5c4593524bae54fdd1713ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 465f6f230bf90bb6a582116f3b0cf506c5e36d2e50c90bd580a22cf1fa0ada6ef593eb0937fc043fa58bc625bca2c3ba3f2a9520f8049561690aff5a52003913
|
7
|
+
data.tar.gz: 7baadc282cc5119fa66abed0e2803028071c61ffb0c3a8c9860d167992c68f3bf6d38eb095d5c9da2a334194d186722fd2a4995525f678ff8e84059d3b91ed88
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Officepod
|
2
2
|
module Authentication
|
3
3
|
def self.included(base)
|
4
|
-
base.
|
4
|
+
base.send :include, InstanceMethods
|
5
5
|
end
|
6
6
|
|
7
|
-
module
|
7
|
+
module InstanceMethods
|
8
8
|
def login
|
9
9
|
validates_body
|
10
|
-
response = self.post(@END_POINT, @options)
|
10
|
+
response = self.class.post(@END_POINT, @options)
|
11
11
|
result = JSON.parse(response.parsed_response)
|
12
12
|
cookie = get_cookie(response.headers["set-cookie"])
|
13
13
|
result["SID"] = cookie
|
@@ -17,7 +17,7 @@ module Officepod
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def logout
|
20
|
-
response = self.delete(@END_POINT, @options)
|
20
|
+
response = self.class.delete(@END_POINT, @options)
|
21
21
|
response.parsed_response
|
22
22
|
end
|
23
23
|
|
data/lib/officepod/bookmark.rb
CHANGED
data/lib/officepod/file.rb
CHANGED
data/lib/officepod/room.rb
CHANGED
data/lib/officepod/storage.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Officepod
|
2
2
|
module Storage
|
3
3
|
def self.included(base)
|
4
|
-
base.
|
4
|
+
base.send :include, InstanceMethods
|
5
5
|
end
|
6
6
|
|
7
|
-
module
|
7
|
+
module InstanceMethods
|
8
8
|
def storage_auth_list(lang: nil, cookie: nil)
|
9
9
|
command = __method__.to_s
|
10
10
|
@options[:command] = command
|
@@ -14,7 +14,7 @@ module Officepod
|
|
14
14
|
}
|
15
15
|
@options[:headers]["Cookie"] = "SID=#{cookie}"
|
16
16
|
ipv4_pattern = /(?:[0-9]{1,3}\.){3}[0-9]{1,3}/
|
17
|
-
response = self.post("/server/request.php", @options)
|
17
|
+
response = self.class.post("/server/request.php", @options)
|
18
18
|
result = JSON.parse(response.parsed_response)
|
19
19
|
result["storagelist"].each do |e|
|
20
20
|
e["type"] = "FTP" if e["title"].include? "FTP"
|
data/lib/officepod/version.rb
CHANGED
data/lib/officepod.rb
CHANGED
@@ -1,35 +1,39 @@
|
|
1
1
|
module Officepod
|
2
2
|
def self.included(base)
|
3
|
-
base.
|
4
|
-
|
3
|
+
base.send :include, InstanceMethods
|
4
|
+
|
5
|
+
base.instance_eval do
|
5
6
|
include HTTParty
|
6
7
|
include Authentication
|
7
8
|
include Storage
|
8
9
|
include Bookmark
|
9
10
|
include File
|
10
11
|
include Room
|
12
|
+
include Helper
|
11
13
|
|
12
14
|
base_uri "http://g4m.lalaworks.com"
|
13
|
-
@END_POINT = "/server/request.php"
|
14
|
-
|
15
|
-
@options = {
|
16
|
-
command: "",
|
17
|
-
headers: {
|
18
|
-
"User-Agent" => "Gate4Mobile",
|
19
|
-
"Content-Type" => "application/x-www-form-urlencoded",
|
20
|
-
"Accept" => "application/json",
|
21
|
-
"Cookie" => ""
|
22
|
-
},
|
23
|
-
body: {}
|
24
|
-
}
|
25
15
|
end
|
26
16
|
|
27
|
-
base.
|
28
|
-
|
17
|
+
base.class_eval do
|
18
|
+
def initialize
|
19
|
+
@END_POINT = "/server/request.php"
|
20
|
+
|
21
|
+
@options = {
|
22
|
+
command: "",
|
23
|
+
headers: {
|
24
|
+
"User-Agent" => "Gate4Mobile",
|
25
|
+
"Content-Type" => "application/x-www-form-urlencoded",
|
26
|
+
"Accept" => "application/json",
|
27
|
+
"Cookie" => ""
|
28
|
+
},
|
29
|
+
body: {}
|
30
|
+
}
|
31
|
+
end
|
29
32
|
end
|
33
|
+
|
30
34
|
end
|
31
35
|
|
32
|
-
module
|
36
|
+
module InstanceMethods
|
33
37
|
def officepod(options={command: "", body: "", cookie: ""})
|
34
38
|
@options[:command] = options[:command]
|
35
39
|
@options[:body] = options[:body]
|
data/spec/officepod_spec.rb
CHANGED
@@ -3,21 +3,36 @@ require 'spec_helper'
|
|
3
3
|
describe Officepod do
|
4
4
|
before(:each) do
|
5
5
|
@klass = Class.new
|
6
|
-
@klass.
|
6
|
+
@klass.class_eval { include Officepod }
|
7
|
+
@instance = @klass.new
|
7
8
|
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
context "Officepod class" do
|
11
|
+
it "has base_uri as a class method" do
|
12
|
+
expect(@klass.respond_to?(:base_uri)).to eq true
|
13
|
+
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
it "has officepod as an instance method" do
|
16
|
+
expect(@klass.instance_methods.include?(:officepod)).to eq true
|
17
|
+
end
|
18
|
+
|
19
|
+
it "has login as an instance method" do
|
20
|
+
expect(@klass.instance_methods.include?(:login)).to eq true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "has @options instance variable" do
|
24
|
+
expect(@instance.instance_variable_defined?(:@options)).to eq true
|
25
|
+
end
|
26
|
+
|
27
|
+
it "has @END_POINT instance variable" do
|
28
|
+
expect(@instance.instance_variable_defined?(:@END_POINT)).to eq true
|
29
|
+
end
|
15
30
|
end
|
16
31
|
|
17
32
|
context "when login" do
|
18
33
|
response = nil
|
19
34
|
|
20
|
-
it "should
|
35
|
+
it "should return hash resonse" do
|
21
36
|
options = {
|
22
37
|
command: "login",
|
23
38
|
headers: {
|
@@ -36,12 +51,12 @@ describe Officepod do
|
|
36
51
|
cookie: ""
|
37
52
|
}
|
38
53
|
|
39
|
-
response = @
|
54
|
+
response = @instance.officepod(options)
|
40
55
|
|
41
56
|
expect(response.class).to eq Hash
|
42
57
|
end
|
43
58
|
|
44
|
-
it "should have storage list" do
|
59
|
+
it "should have storage list as array" do
|
45
60
|
expect(response["storage_list"].class).to eq Array
|
46
61
|
end
|
47
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: officepod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoochan Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|