officepod 0.1.2 → 0.1.3

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: 8d2408e64903daf9b60dd50fc3ffbf6987f3ed5e
4
- data.tar.gz: 71866d2f85b39a84090126a91dfa28e58003cce9
3
+ metadata.gz: 6de93154e36e994448ce973761527fa299bbda34
4
+ data.tar.gz: f67266cba6a495996a8042d414f8acf41fd5bd23
5
5
  SHA512:
6
- metadata.gz: d3e150789bd22e013a925bbbfe3d475fdb6c7e10af091a6f8cf1ccb9ea2027f83018b23aa9efd624915fec774edb90af13185773e34efe3bc60134c9cddfe4d4
7
- data.tar.gz: 4ccf453cd28b4f647252fee12bd475566587a2a0210b511f6a9de785b5f3b773d8d83ca3d9b44b730cafe871ded1f011f1904d18f06dc95c07c0759739450dec
6
+ metadata.gz: b797312b7d74d07d2c6851120a5a8ea7850eeff186551febc5f1aaa4053fe83cb49b5d4e97dd37e1c197bf02d05fd2287dd7af32f76f57f156ec61a6ae3b2649
7
+ data.tar.gz: b9d44f53c85adf70a44f57a5981afd4c7f6f11fa244e8386d1df30261133d93b03ef69adbf667f483aeb050804008188e9d50dc35be70dd6731070890faa6c93
@@ -6,6 +6,7 @@ module Officepod
6
6
 
7
7
  module ClassMethods
8
8
  def login
9
+ validates_body
9
10
  response = self.post(@END_POINT, @options)
10
11
  result = JSON.parse(response.parsed_response)
11
12
  cookie = get_cookie(response.headers["set-cookie"])
@@ -0,0 +1,33 @@
1
+ module Officepod
2
+ module Helper
3
+ def validates_command
4
+ if command_empty?
5
+ ::Kernel.raise EmptyCommand.new
6
+ else
7
+ if unsupported_command?
8
+ ::Kernel.raise UnsupportedCommand.new(@options[:command])
9
+ end
10
+ end
11
+ end
12
+
13
+ def validates_body
14
+ ::Kernel.raise EmptyBody.new if body_empty?
15
+ end
16
+
17
+ def unsupported_command?
18
+ !(self.class_methods.include? @options[:command].to_sym)
19
+ end
20
+
21
+ def command_empty?
22
+ @options[:command].empty?
23
+ end
24
+
25
+ def body_empty?
26
+ @options[:body].empty?
27
+ end
28
+
29
+ def class_methods
30
+ self.methods - Object.methods
31
+ end
32
+ end
33
+ end
@@ -1,3 +1,3 @@
1
1
  module Officepod
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/officepod.rb CHANGED
@@ -23,6 +23,10 @@ module Officepod
23
23
  body: {}
24
24
  }
25
25
  end
26
+
27
+ base.instance_eval do
28
+ extend Helper
29
+ end
26
30
  end
27
31
 
28
32
  module ClassMethods
@@ -33,42 +37,13 @@ module Officepod
33
37
  validates_command
34
38
  send(options[:command])
35
39
  end
36
-
37
- def validates_command
38
- if command_empty?
39
- ::Kernel.raise EmptyCommand.new
40
- else
41
- if unsupported_command?
42
- ::Kernel.raise UnsupportedCommand.new(@options[:command])
43
- end
44
- end
45
- end
46
-
47
- def validates_body
48
- ::Kernel.raise EmptyBody.new
49
- end
50
-
51
- def unsupported_command?
52
- !(self.class_methods.include? @options[:command].to_sym)
53
- end
54
-
55
- def command_empty?
56
- @options[:command].empty?
57
- end
58
-
59
- def body_empty?
60
- @options[:body].empty?
61
- end
62
-
63
- def class_methods
64
- self.methods - Object.methods
65
- end
66
40
  end
67
41
 
68
42
  end
69
43
 
70
44
  require "json"
71
45
  require "httparty"
46
+ require "officepod/helper"
72
47
  require "officepod/exception"
73
48
  require "officepod/authentication"
74
49
  require "officepod/storage"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: officepod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoochan Seo
@@ -65,6 +65,7 @@ files:
65
65
  - lib/officepod/bookmark.rb
66
66
  - lib/officepod/exception.rb
67
67
  - lib/officepod/file.rb
68
+ - lib/officepod/helper.rb
68
69
  - lib/officepod/room.rb
69
70
  - lib/officepod/storage.rb
70
71
  - lib/officepod/version.rb