hotdogprincess 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -6
- data/lib/hotdogprincess/client.rb +29 -9
- data/lib/hotdogprincess/version.rb +1 -1
- 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: 075d86dcd2836ee83901540f991ad86257123b23
|
4
|
+
data.tar.gz: 166f9efaa0c6f0487d694629943b77014a33a158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54126fd33b3afafcf3de39cad4f10a4136491398761341a3e2a8ecfd00efde8f1d8f4c4d565958a1f16f6eba9cad626ae6bc7704a5da24263de2d47cf2f47cb0
|
7
|
+
data.tar.gz: a5427b892f0358cb8f0e49d230fa57963cd519b2f888645b4f60ece1da3986d037483f064a823e237cfce841fd67c60c71ac2c673322470387ffab1f55baf21e
|
data/README.md
CHANGED
@@ -48,23 +48,33 @@ From here you can do all sorts of wonderful things:
|
|
48
48
|
|
49
49
|
```ruby
|
50
50
|
# Schema, Status, View
|
51
|
-
client.
|
52
|
-
client.
|
53
|
-
client.
|
51
|
+
client.schema_raw 'Customer'
|
52
|
+
client.schema_raw 'Ticket'
|
53
|
+
client.schema_raw 'Sla'
|
54
54
|
=> {"?xml"=>{"@version"=>"1.0", "@encoding"=>"utf-8"}, "Customer"=> ...
|
55
55
|
|
56
|
-
client.
|
57
|
-
client.
|
58
|
-
client.
|
56
|
+
client.status_raw 'Customer'
|
57
|
+
client.status_raw 'Ticket'
|
58
|
+
client.status_raw 'Sla'
|
59
59
|
=> {"?xml"=>{"@version"=>"1.0", "@encoding"=>"utf-8"}, "entities"=> ...
|
60
60
|
|
61
61
|
|
62
62
|
# Well that's neat, but XML? What the hell is wrong with you, is it 2001‽
|
63
|
+
client.schema 'Customer'
|
64
|
+
client.schema 'Ticket'
|
65
|
+
client.schema 'Sla'
|
66
|
+
=> #<Hash ...
|
67
|
+
|
63
68
|
client.schema_json 'Customer'
|
64
69
|
client.schema_json 'Ticket'
|
65
70
|
client.schema_json 'Sla'
|
66
71
|
=> # See below for important details about all JSON returns.
|
67
72
|
|
73
|
+
client.status 'Customer'
|
74
|
+
client.status 'Ticket'
|
75
|
+
client.status 'Sla'
|
76
|
+
=> #<Hash ...
|
77
|
+
|
68
78
|
client.status_json 'Customer'
|
69
79
|
client.status_json 'Ticket'
|
70
80
|
client.status_json 'Sla'
|
@@ -110,41 +110,61 @@ module HotDogPrincess
|
|
110
110
|
response_hash
|
111
111
|
end
|
112
112
|
|
113
|
-
def
|
113
|
+
def status_raw(object)
|
114
114
|
get "#{object.to_s}/status"
|
115
115
|
end
|
116
116
|
|
117
|
-
def
|
118
|
-
status =
|
117
|
+
def status(object)
|
118
|
+
status = status_raw(object)
|
119
119
|
if status['Entities'] and status['Entities']['Status']
|
120
120
|
status_hash = schema_parse(status['Entities']['Status'])
|
121
121
|
elsif status['entities'] and status['entities']['Status']
|
122
122
|
# With _output_=json the container is lowercase for some reason.
|
123
123
|
status_hash = schema_parse(status['entities']['Status'])
|
124
124
|
end
|
125
|
+
status_hash
|
126
|
+
end
|
125
127
|
|
128
|
+
def status_json(object)
|
129
|
+
status = status_raw(object)
|
130
|
+
if status['Entities'] and status['Entities']['Status']
|
131
|
+
status_hash = schema_parse(status['Entities']['Status'])
|
132
|
+
elsif status['entities'] and status['entities']['Status']
|
133
|
+
# With _output_=json the container is lowercase for some reason.
|
134
|
+
status_hash = schema_parse(status['entities']['Status'])
|
135
|
+
end
|
126
136
|
JSON.generate(status_hash)
|
127
137
|
end
|
128
138
|
|
129
|
-
def
|
139
|
+
def view_raw(object)
|
130
140
|
get "#{object.to_s}/view"
|
131
141
|
end
|
132
142
|
|
133
|
-
def
|
134
|
-
views =
|
143
|
+
def view(object)
|
144
|
+
views = view_raw(object)
|
135
145
|
views_hash = schema_parse(views['Entities']['View'])
|
146
|
+
views_hash
|
147
|
+
end
|
136
148
|
|
149
|
+
def view_json(object)
|
150
|
+
views = view_raw(object)
|
151
|
+
views_hash = schema_parse(views['Entities']['View'])
|
137
152
|
JSON.generate(views_hash)
|
138
153
|
end
|
139
154
|
|
140
|
-
def
|
155
|
+
def schema_raw(object)
|
141
156
|
get "#{object.to_s}/schema"
|
142
157
|
end
|
143
158
|
|
144
|
-
def
|
145
|
-
schema =
|
159
|
+
def schema(object)
|
160
|
+
schema = schema_raw(object)
|
146
161
|
schema_hash = schema_parse_hash(schema[object])
|
162
|
+
schema_hash
|
163
|
+
end
|
147
164
|
|
165
|
+
def schema_json(object)
|
166
|
+
schema = schema_raw(object)
|
167
|
+
schema_hash = schema_parse_hash(schema[object])
|
148
168
|
JSON.generate(schema_hash)
|
149
169
|
end
|
150
170
|
|