megam_api 1.8.7 → 1.8.8
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/megam/api/license.rb +2 -11
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/license.rb +3 -25
- 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: 919a36834fe6294eae7980cdaf1dfc02effba90e
|
4
|
+
data.tar.gz: 3bace61750223469f20a6696274c40d7c12f42b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04a8f05a46ac3824ea625f408732addfabe6099fa538eb9c581ad69c61b5371c618cbf16bb952951bb4221eea53d68d5e2ee462604e63fc02521288ce15d47fa
|
7
|
+
data.tar.gz: 3c16718bac74093cbd606d74199524fb7ea60cac7c08f6967380fe6874765f5b0d24991df7f06febc838c3b19cc7653f253d8167ae1dc4c332eaf56412566bd8
|
data/lib/megam/api/license.rb
CHANGED
@@ -1,17 +1,8 @@
|
|
1
1
|
module Megam
|
2
2
|
class API
|
3
|
-
def get_licenses
|
4
|
-
@options = {:path => '/license',:body => ""}.merge(@options)
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
:method => :get,
|
9
|
-
:body => @options[:body]
|
10
|
-
)
|
11
|
-
end
|
12
|
-
|
13
|
-
def get_license(license_name)
|
14
|
-
@options = {:path => "/license/#{license_name}",:body => ""}.merge(@options)
|
4
|
+
def get_license(license_id)
|
5
|
+
@options = {:path => "/licenses/#{license_id}",:body => ""}.merge(@options)
|
15
6
|
|
16
7
|
request(
|
17
8
|
:expects => 200,
|
data/lib/megam/api/version.rb
CHANGED
data/lib/megam/core/license.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Megam
|
2
2
|
class License < Megam::RestAdapter
|
3
3
|
def initialize(o)
|
4
|
-
@org_id = nil
|
5
4
|
@data = nil
|
6
5
|
@some_msg = {}
|
7
6
|
super(o)
|
@@ -11,16 +10,6 @@ module Megam
|
|
11
10
|
self
|
12
11
|
end
|
13
12
|
|
14
|
-
def org_id(arg=nil)
|
15
|
-
if arg != nil
|
16
|
-
@org_id= arg
|
17
|
-
else
|
18
|
-
@org_id
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
13
|
|
25
14
|
def data(arg=nil)
|
26
15
|
if arg != nil
|
@@ -46,7 +35,6 @@ module Megam
|
|
46
35
|
def to_hash
|
47
36
|
index_hash = Hash.new
|
48
37
|
index_hash["json_claz"] = self.class.name
|
49
|
-
index_hash["org_id"] = org_id
|
50
38
|
index_hash["data"] = data
|
51
39
|
index_hash
|
52
40
|
end
|
@@ -59,7 +47,6 @@ module Megam
|
|
59
47
|
|
60
48
|
def for_json
|
61
49
|
result = {
|
62
|
-
"org_id" => org_id,
|
63
50
|
"data" => data
|
64
51
|
}
|
65
52
|
result
|
@@ -68,7 +55,7 @@ module Megam
|
|
68
55
|
#
|
69
56
|
def self.json_create(o)
|
70
57
|
license = new({})
|
71
|
-
|
58
|
+
license.data(o["results"]["data"]) if o["results"]
|
72
59
|
#success or error
|
73
60
|
license.some_msg[:code] = o["code"] if o.has_key?("code")
|
74
61
|
license.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
@@ -84,7 +71,6 @@ module Megam
|
|
84
71
|
end
|
85
72
|
|
86
73
|
def from_hash(o)
|
87
|
-
@org_id = o[:org_id] if o.has_key?(:org_id)
|
88
74
|
@data = o[:data] if o.has_key?(:data)
|
89
75
|
self
|
90
76
|
end
|
@@ -99,19 +85,11 @@ module Megam
|
|
99
85
|
megam_rest.post_license(to_hash)
|
100
86
|
end
|
101
87
|
|
102
|
-
#
|
103
|
-
# returns a LicensesCollection
|
104
|
-
# don't return self. check if the Megam::LicenseCollection is returned.
|
105
|
-
def self.list(params)
|
106
|
-
license = self.new(params)
|
107
|
-
license.megam_rest.get_license
|
108
|
-
end
|
109
|
-
|
110
|
-
# Show a particular License by name,
|
88
|
+
# Show a particular License by id,
|
111
89
|
# Megam::License
|
112
90
|
def self.show(params)
|
113
91
|
pre = self.new(params)
|
114
|
-
pre.megam_rest.get_license(params["
|
92
|
+
pre.megam_rest.get_license(params["id"])
|
115
93
|
end
|
116
94
|
|
117
95
|
def to_s
|