davetron5000-gliffy 0.1.7 → 0.2.0
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.
- data/README.rdoc +175 -48
- data/bin/gliffy +298 -22
- data/lib/gliffy.rb +4 -0
- data/lib/gliffy/credentials.rb +78 -0
- data/lib/gliffy/handle.rb +269 -290
- data/lib/gliffy/request.rb +101 -0
- data/lib/gliffy/response.rb +248 -91
- data/lib/gliffy/url.rb +133 -36
- metadata +21 -21
- data/lib/gliffy/account.rb +0 -55
- data/lib/gliffy/cli.rb +0 -144
- data/lib/gliffy/commands.rb +0 -6
- data/lib/gliffy/commands/delete.rb +0 -10
- data/lib/gliffy/commands/edit.rb +0 -19
- data/lib/gliffy/commands/get.rb +0 -46
- data/lib/gliffy/commands/list.rb +0 -27
- data/lib/gliffy/commands/new.rb +0 -25
- data/lib/gliffy/commands/url.rb +0 -21
- data/lib/gliffy/config.rb +0 -55
- data/lib/gliffy/diagram.rb +0 -100
- data/lib/gliffy/folder.rb +0 -63
- data/lib/gliffy/rest.rb +0 -110
- data/lib/gliffy/user.rb +0 -72
data/lib/gliffy/user.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'rexml/document'
|
2
|
-
require 'array_has_response'
|
3
|
-
require 'gliffy/rest'
|
4
|
-
|
5
|
-
include REXML
|
6
|
-
|
7
|
-
module Gliffy
|
8
|
-
|
9
|
-
# A user token
|
10
|
-
class UserToken < Response
|
11
|
-
attr_reader :expiration
|
12
|
-
attr_reader :token
|
13
|
-
def self.from_xml(element)
|
14
|
-
expiration = Time.at(element.attributes['expiration'].to_i / 1000)
|
15
|
-
token = element.text
|
16
|
-
UserToken.new(expiration,token)
|
17
|
-
end
|
18
|
-
|
19
|
-
def expired?
|
20
|
-
Time.now > expiration
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(expiration,token)
|
24
|
-
super()
|
25
|
-
@expiration = expiration
|
26
|
-
@token = token
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
class Users < ArrayResponseParser; end
|
32
|
-
|
33
|
-
# A user of Gliffy and the main entry point to using the API (see #initiate_session)
|
34
|
-
class User < Response
|
35
|
-
|
36
|
-
# The user's username, which is their identifier within an account
|
37
|
-
attr_reader :username
|
38
|
-
# The user's email, which is unique to them in the entire Gliffy system.
|
39
|
-
# Note that this isn't guaranteed to be a real email, nor is
|
40
|
-
# it guaranteed to be the user's actual email. This is
|
41
|
-
# assigned by the system unless overridden by the API.
|
42
|
-
attr_reader :email
|
43
|
-
attr_reader :id
|
44
|
-
|
45
|
-
def self.from_xml(element)
|
46
|
-
id = element.attributes['id'].to_i
|
47
|
-
is_admin = false
|
48
|
-
is_admin = element.attributes['is-admin'] == 'true' if element.attributes['is-admin']
|
49
|
-
username = element.elements['username'] ? element.elements['username'].text : nil
|
50
|
-
email = element.elements['email'] ? element.elements['email'].text : nil
|
51
|
-
|
52
|
-
User.new(id,is_admin,username,email)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Returns true if this user is an admin of the account in which they live
|
56
|
-
def is_admin?
|
57
|
-
@is_admin
|
58
|
-
end
|
59
|
-
|
60
|
-
protected
|
61
|
-
|
62
|
-
def initialize(id,is_admin,username,email)
|
63
|
-
super()
|
64
|
-
@id = id
|
65
|
-
@is_admin = is_admin
|
66
|
-
@username = username
|
67
|
-
@email = email
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|