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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5fee42aeeb40e8d26b7cf18eab7efb950c2fbabd
4
- data.tar.gz: e82be35e10165d0325a503ed25e48141e4443867
3
+ metadata.gz: 075d86dcd2836ee83901540f991ad86257123b23
4
+ data.tar.gz: 166f9efaa0c6f0487d694629943b77014a33a158
5
5
  SHA512:
6
- metadata.gz: a248a7fb2de7bf11d18c87ee3c9e6bcbb8cdf6ab118b1a499326f1ea2c3e8bbb670bcf4488c5005400578006cffc820024752a7e3172308933cc608a86b85e5a
7
- data.tar.gz: d2adcdb072f38bee64e6375ae8c01d8bfc6fb9b7f092e779ba296d5887b19c72eab38e0c21a569158bb6be8f7744fd906fe24c35942a716f83f634e8e0e9c3c8
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.schema 'Customer'
52
- client.schema 'Ticket'
53
- client.schema 'Sla'
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.status 'Customer'
57
- client.status 'Ticket'
58
- client.status 'Sla'
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 status(object)
113
+ def status_raw(object)
114
114
  get "#{object.to_s}/status"
115
115
  end
116
116
 
117
- def status_json(object)
118
- status = status(object)
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 view(object)
139
+ def view_raw(object)
130
140
  get "#{object.to_s}/view"
131
141
  end
132
142
 
133
- def view_json(object)
134
- views = view(object)
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 schema(object)
155
+ def schema_raw(object)
141
156
  get "#{object.to_s}/schema"
142
157
  end
143
158
 
144
- def schema_json(object)
145
- schema = schema(object)
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
 
@@ -1,3 +1,3 @@
1
1
  module HotDogPrincess
2
- VERSION = "0.1.3".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotdogprincess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Callis