hookercookerman / amee

Ruby gem to interact with the Amee Api

This URL has Read+Write access

amee / .yardoc
100644 816 lines (805 sloc) 56.191 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
[IC:SymbolHash{:#Amee::Session#get_profile_itemo:$YARD::CodeObjects::MethodObject:@namespaceo:#YARD::CodeObjects::ClassObject: @aliases{;o:$YARD::CodeObjects::ModuleObject;
{;o:"YARD::CodeObjects::RootObject ;
{;0:
@tags[:@attributesIC;{:
classIC;{:@symbolize_valueT: instanceIC;{;T;T:
@name: root: @mixinsIC:&YARD::CodeObjects::CodeObjectList[: @owner@ :@docstring":@childrenIC;[@
;@ ; [;IC;{;IC;{;T;IC;{;T;T;: Amee:
@file"lib/amee/cli.rb;IC;[;@
;";IC;[(o; ;
{;@
:@superclasso:YARD::CodeObjects::Proxy;@
;: Object: @obj0; [;IC;{;IC;{;T;IC;{;T;T;:CLI;@;IC;[;@;";IC;[o;;@; [: @source"def self.execute(stdout, arguments=[])
 
  # NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
 
  options = {
    :path => '~'
  }
  mandatory_options = %w( )
 
  parser = OptionParser.new do |opts|
    opts.banner = "This application is wonderful because...\n\nUsage: \#{File.basename($0)} [options]\n\nOptions are:\n".gsub(/^ /,'')
    opts.separator ""
    opts.on("-p", "--path=PATH", String,
            "This is a sample message.",
            "For multiple lines, add more strings.",
            "Default: ~") { |arg| options[:path] = arg }
    opts.on("-h", "--help",
            "Show this help message.") { stdout.puts opts; exit }
    opts.parse!(arguments)
 
    if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
      stdout.puts opts; exit
    end
  end
 
  path = options[:path]
 
  # do stuff
  stdout.puts "To update this executable, look in lib/amee/cli.rb"
end;: execute;@: @scope;;":@explicitT:@signature"+def self.execute(stdout, arguments=[]):@visibility: public:
@linei
;@;'i o; ;
{;@
;o;;@
;;;0; [;IC;{;IC;{:configurationIC;{:
writeo;;@,; [o:YARD::Tags::Tag : @types[:@tag_name"
param;"
value:
@text"7the value to set the attribute +configuration+ to.; ";def configuration=(value)
  @configuration = value
end;:configuration=;"lib/amee/config.rb;";;"'Sets the attribute +configuration+;$"def configuration=(value);%;&;'i :@short_docstring0: reado;;@,; [; "+def configuration
  @configuration
end;;(;@;;";;"3Returns the value of attribute +configuration+;$"def configuration;%;&;'i ;/0;T;T;IC;{;T;T;: Config;@;;IC;[;@,;";IC;[ @3@>o;;@,; [; "def defaults
  @defaults ||= {
    :cache => false,
    :cache_store => 'Moneta::Memory',
    :server => "stage.amee.com",
    :auth_path => "/auth",
    :accept => "application/json",
    :logging => true
  }
end;: defaults;@;;";;";#T;$"def defaults;%;&;'i o;;@,; [o;* ;+0;," example;";-"O Amee::Config.set |config| do
    config[:server] = "dev.aimee.com"
  endo;* ;+[;," return;0;-"nilo;* ;+["@configuration;,"
yield;0;-": @dynamicT; "Kdef set
  @configuration ||= defaults
  yield @configuration
  nil
end;:set;@;;";;"yields the configuration;#T;$" def set;%;&;/0;'io;;@,; [;3T; "@def key?(key)
  (@configuration ||= defaults).key?(key)
end;: key?;@;;";;";#T;$"def key?(key);%;&;'i%o;;@,; [o;* ;+[" Object;,"
param;"key;-"%the key to return the value fromo;* ;+[" Object;," return;0;-";3T; "9def [](key)
  (@configuration ||= defaults)[key]
end;:[];@;;";;"'Retrieve the value from the config;#T;$"def [](key);%;&;/0;'i.o;;@,; [;3T; "Edef []=(key, val)
  (@configuration ||= defaults)[key] = val
end;:[]=;@;;";;"!sets the value of the config;#T;$"def []=(key, val);%;&;/0;'i3o;;@,; [;3T; "Ddef delete(key)
  (@configuration ||= defaults).delete(key)
end;: delete;@;;";;"( deletes the value from the config;#T;$"def delete(key);%;&;/0;'i8;@,;'io; ;
{;@
; [;IC;{;IC;{;T;IC;{;T;T;: DataApi;"'lib/amee/data_api/data_category.rb;IC;[;@};";IC;[ o; ;
{;@};o;;@};;;0; [;IC;{;IC;{;T;IC;{:data_categoryIC;{;)o;;@; [; ";def data_category=(value)
  @data_category = value
end;:data_category=;@~;";;"$essentially the parent category;$"def data_category=(value);%;&;'i;/0;0o;;@; [; "+def data_category
  @data_category
end;;:;@~;";;"$essentially the parent category;$"def data_category;%;&;'i;/0;T;T;T;:DataCategory;@~;IC;[o;
;o;;@;;;@
:@origname"Amee::Model;:
Model:@orignamespace@;o; ;
{;@
; [;IC;{;IC;{;T;IC;{;T;T;;>;"lib/amee/model.rb;IC;[;@;";IC;[o;;@; [; "def self.included(base)
  base.extend ClassMethods
  base.__send__(:attr_writer, :session)
  base.__send__(:attr_accessor, :path)
  base.__send__(:attr_accessor, :uid)
  base.__send__(:attr_accessor, :name)
  base.__send__(:attr_accessor, :modified)
  base.__send__(:attr_accessor, :created)
  base.__send__(:attr_accessor, :resource_path)
  
  base.class_eval do
    class << base; attr_reader :lazy_populators end
    class << base; attr_accessor :path_prefix end
    path_prefix = ""
  end
end;: included;@;";;";#T;$"def self.included(base);%;&;'io; ;
{;@; [;3T;IC;{;IC;{;T;IC;{;T;T;:ClassMethods;@;IC;[;@;";IC;[o;;@; [o;* ;+[" instance;,"
yield;0;-"; "wdef from_hash(hash, session = nil)
  instance = new(hash, session)
  yield instance if block_given?
  instance
end;:from_hash;@;";;";#T;$"'def from_hash(hash, session = nil);%;&;'io;;@; [;3T; "def item_populators(hash)
  @lazy_populators ||= [] << hash.keys
  populator_getters(hash.keys)
  hash.each_pair do |key, value|
    
    define_method("#{key}=") do |definition|
      if session && !definition.nil?
        if self.resource_path
          definition["resource_path"] = self.resource_path+"/#{definition["path"]}"
        end
        instance_variable_set("@#{key}", value[:class].new(definition, session))
      end
    end
    
  end
end;:item_populators;@;";;";#T;$"def item_populators(hash);%;&;'i!o;;@; [;3T; "def list_populators(hash)
@lazy_populators ||= [] << hash.keys
populator_getters(hash.keys)
hash.each_pair do |key, value|
  
  define_method("#{key}=") do |list|
    instance_variable_set("@#{key}", list.map do |item|
      if self.resource_path
        item["resource_path"] = self.resource_path+"/#{item["path"]}"
      end
      value[:class].new(item, session)
    end) if session
  end
    
end;:list_populators;@;";;";#T;$"def list_populators(hash);%;&;'i2;@;'io;;@; [; "def populator_getters(pops)
  pops.each do |symbol|
     define_method(symbol) do
       if !populated? && self.resource_path
         populate!
       end
       instance_variable_get("@#{symbol}")
     end
   end
end;:populator_getters;@;";;";#T;$" def populator_getters(pops);%;&;'iC;@;'i;@;";IC;[
@@o;;@; [o;* ;+[" Hash;,"
param;"selection;-""of what we wish to drill downo;* ;+["Amee::DataApi::Drill;," return;0;-"/if we can drill down we get a drill objecto;* ;+["nil;," return;0;-"<if we cannot drill then nil will be the name of the day; "vdef drill(selections = {})
  if can_drill?
    session.drill(self.full_path, :selections => selections)
  end
end;:
drill;@~;";;"?we can only drill with a data_category that has data_items;#T;$"def drill(selections = {});%;&;/0;'io;;@; [;3T; ",def can_drill?
  !data_items.empty?
end;:can_drill?;@~;";;";#T;$"def can_drill?;%;&;'io;;@; [;3T; "def populate!
  session.api_call(:get, "data.category", self.full_path) do |response|
    populate_from_hash!(response)
  end
end;:populate!;@~;";;";#T;$"def populate!;%;&;'i#;@;'i o; ;
{;@};o;;@};;;0; [;IC;{;IC;{;T;IC;{ :
labelIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"/the value to set the attribute +label+ to.; "+def label=(value)
  @label = value
end;: label=;"#lib/amee/data_api/data_item.rb;";;"Sets the attribute +label+;$"def label=(value);%;&;'i;/0;0o;;@; [; "def label
  @label
end;;I;@;";;"+Returns the value of attribute +label+;$"def label;%;&;'i;/0;T:start_dateIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"4the value to set the attribute +start_date+ to.; "5def start_date=(value)
  @start_date = value
end;:start_date=;@;";;"$Sets the attribute +start_date+;$"def start_date=(value);%;&;'i;/0;0o;;@; [; "%def start_date
  @start_date
end;;K;@;";;"0Returns the value of attribute +start_date+;$"def start_date;%;&;'i;/0;T: end_dateIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"2the value to set the attribute +end_date+ to.; "1def end_date=(value)
  @end_date = value
end;:end_date=;@;";;""Sets the attribute +end_date+;$"def end_date=(value);%;&;'i;/0;0o;;@; [; "!def end_date
  @end_date
end;;M;@;";;".Returns the value of attribute +end_date+;$"def end_date;%;&;'i;/0;T: choicesIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"1the value to set the attribute +choices+ to.; "/def choices=(value)
  @choices = value
end;: choices=;@;";;"!Sets the attribute +choices+;$"def choices=(value);%;&;'i;/0;0o;;@; [; "def choices
  @choices
end;;O;@;";;"-Returns the value of attribute +choices+;$"def choices;%;&;'i;/0;T;T;T;: DataItem;@;IC;[o;
;o;;@;;;@
;="Amee::Model;;>;?@;@;@;";IC;[@@ @@@@@#@-o;;@; [; "}def populate!
  session.api_call(:get, "data.item", self.full_path) do |response|
    populate_from_hash!(response)
  end
end;;H;@;";;";#T;$"def populate!;%;&;'i;@;'i
o; ;
{;@};o;;@};;;0; [;IC;{;IC;{;T;IC;{ :data_itemIC;{;)o;;@=; [o;* ;+[;,"
param;"
value;-"3the value to set the attribute +data_item+ to.; "3def data_item=(value)
  @data_item = value
end;:data_item=;")lib/amee/data_api/data_item_value.rb;";;"#Sets the attribute +data_item+;$"def data_item=(value);%;&;'i ;/0;0o;;@=; [; "#def data_item
  @data_item
end;;R;@M;";;"/Returns the value of attribute +data_item+;$"def data_item;%;&;'i ;/0;T:
valueIC;{;)o;;@=; [o;* ;+[;,"
param;"
value;-"/the value to set the attribute +value+ to.; "+def value=(value)
  @value = value
end;: value=;@M;";;"Sets the attribute +value+;$"def value=(value);%;&;'i ;/0;0o;;@=; [; "def value
  @value
end;;T;@M;";;"+Returns the value of attribute +value+;$"def value;%;&;'i ;/0;T:display_nameIC;{;)o;;@=; [o;* ;+[;,"
param;"
value;-"6the value to set the attribute +display_name+ to.; "9def display_name=(value)
  @display_name = value
end;:display_name=;@M;";;"&Sets the attribute +display_name+;$"def display_name=(value);%;&;'i ;/0;0o;;@=; [; ")def display_name
  @display_name
end;;V;@M;";;"2Returns the value of attribute +display_name+;$"def display_name;%;&;'i ;/0;T:display_pathIC;{;)o;;@=; [o;* ;+[;,"
param;"
value;-"6the value to set the attribute +display_path+ to.; "9def display_path=(value)
  @display_path = value
end;:display_path=;@M;";;"&Sets the attribute +display_path+;$"def display_path=(value);%;&;'i ;/0;0o;;@=; [; ")def display_path
  @display_path
end;;X;@M;";;"2Returns the value of attribute +display_path+;$"def display_path;%;&;'i ;/0;T: unitIC;{;)o;;@=; [o;* ;+[;,"
param;"
value;-".the value to set the attribute +unit+ to.; ")def unit=(value)
  @unit = value
end;:
unit=;@M;";;"Sets the attribute +unit+;$"def unit=(value);%;&;'i ;/0;0o;;@=; [; "def unit
  @unit
end;;Z;@M;";;"*Returns the value of attribute +unit+;$" def unit;%;&;'i ;/0;T: per_unitIC;{;)o;;@=; [o;* ;+[;,"
param;"
value;-"2the value to set the attribute +per_unit+ to.; "1def per_unit=(value)
  @per_unit = value
end;:per_unit=;@M;";;""Sets the attribute +per_unit+;$"def per_unit=(value);%;&;'i ;/0;0o;;@=; [; "!def per_unit
  @per_unit
end;;\;@M;";;".Returns the value of attribute +per_unit+;$"def per_unit;%;&;'i ;/0;T:descriptionIC;{;)o;;@=; [o;* ;+[;,"
param;"
value;-"5the value to set the attribute +description+ to.; "7def description=(value)
  @description = value
end;:description=;@M;";;"%Sets the attribute +description+;$"def description=(value);%;&;'i ;/0;0o;;@=; [; "'def description
  @description
end;;^;@M;";;"1Returns the value of attribute +description+;$"def description;%;&;'i ;/0;T;T;T;:DataItemValue;@M;IC;[o;
;o;;@ ;;;@
;="Amee::Model;;>;?@ ;@;@=;";IC;[@f@p@@@V@`@v@@@@@@E@P;@=;'i o; ;
{;@};o;;@};;;0; [;IC;{;IC;{;T;IC;{:selectionsIC;{;)o;;@; [; "5def selections=(value)
  @selections = value
end;:selections=;"$lib/amee/data_api/drill_down.rb;";;"`choices are an array of hashes with keys "value" and "name"
same for the selections as well;$"def selections=(value);%;&;'i;/0;0o;;@; [; "%def selections
  @selections
end;;a;@;";;"`choices are an array of hashes with keys "value" and "name"
same for the selections as well;$"def selections;%;&;'i;/0;T;OIC;{;)o;;@; [; "/def choices=(value)
  @choices = value
end;;P;@;";;"`choices are an array of hashes with keys "value" and "name"
same for the selections as well;$"def choices=(value);%;&;'i;/0;0o;;@; [; "def choices
  @choices
end;;O;@;";;"`choices are an array of hashes with keys "value" and "name"
same for the selections as well;$"def choices;%;&;'i;/0;T:choice_nameIC;{;)o;;@; [; "7def choice_name=(value)
  @choice_name = value
end;:choice_name=;@;";;"`choices are an array of hashes with keys "value" and "name"
same for the selections as well;$"def choice_name=(value);%;&;'i;/0;0o;;@; [; "'def choice_name
  @choice_name
end;;c;@;";;"`choices are an array of hashes with keys "value" and "name"
same for the selections as well;$"def choice_name;%;&;'i;/0;T;T;T;:DrillDown;@;IC;[o;
;o;;@ ;;;@
;="Amee::Model;;>;?@ ;@;@;";IC;[ @@@@@@o;;@; [; "Kdef data_item_uid
  if uid_found?
    choices.first["value"]
  end
end;:data_item_uid;@;";;";#T;$"def data_item_uid;%;&;'io;;@; [;3T; ".def uid_found?
  choice_name == "uid"
end;:uid_found?;@;";;";#T;$"def uid_found?;%;&;'i;@;'io; ;
{;@};o;;@};;;0; [;IC;{;IC;{;T;IC;{:drill_downIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"4the value to set the attribute +drill_down+ to.; "5def drill_down=(value)
  @drill_down = value
end;:drill_down=;")lib/amee/data_api/item_definition.rb;";;"$Sets the attribute +drill_down+;$"def drill_down=(value);%;&;'i ;/0;0o;;@; [; "%def drill_down
  @drill_down
end;;h;@;";;"0Returns the value of attribute +drill_down+;$"def drill_down;%;&;'i ;/0;T;T;T;:ItemDefinition;@;IC;[o;
;o;;@ ;;;@
;="Amee::Model;;>;?@ ;@;@;";IC;[@@;@;'io; ;
{;@};o;;@};;;0; [;IC;{;IC;{;T;IC;{:from_profileIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"6the value to set the attribute +from_profile+ to.; "9def from_profile=(value)
  @from_profile = value
end;:from_profile=;"/lib/amee/data_api/item_value_definition.rb;";;"&Sets the attribute +from_profile+;$"def from_profile=(value);%;&;'i ;/0;0o;;@; [; ")def from_profile
  @from_profile
end;;k;@";";;"2Returns the value of attribute +from_profile+;$"def from_profile;%;&;'i ;/0;T:from_dataIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"3the value to set the attribute +from_data+ to.; "3def from_data=(value)
  @from_data = value
end;:from_data=;@";";;"#Sets the attribute +from_data+;$"def from_data=(value);%;&;'i ;/0;0o;;@; [; "#def from_data
  @from_data
end;;m;@";";;"/Returns the value of attribute +from_data+;$"def from_data;%;&;'i ;/0;T;T;T;:ItemValueDefinition;@";IC;[o;
;o;;@;;;@
;="Amee::Model;;>;?@;@;@;";IC;[ @@%@+@5;@;'i o; ;
{;@};o;;@};;;0; [;IC;{;IC;{;T;IC;{:value_typeIC;{;)o;;@@; [o;* ;+[;,"
param;"
value;-"4the value to set the attribute +value_type+ to.; "5def value_type=(value)
  @value_type = value
end;:value_type=;"*lib/amee/data_api/value_definition.rb;";;"$Sets the attribute +value_type+;$"def value_type=(value);%;&;'i ;/0;0o;;@@; [; "%def value_type
  @value_type
end;;p;@P;";;"0Returns the value of attribute +value_type+;$"def value_type;%;&;'i ;/0;T;^IC;{;)o;;@@; [o;* ;+[;,"
param;"
value;-"5the value to set the attribute +description+ to.; "7def description=(value)
  @description = value
end;;_;@P;";;"%Sets the attribute +description+;$"def description=(value);%;&;'i ;/0;0o;;@@; [; "'def description
  @description
end;;^;@P;";;"1Returns the value of attribute +description+;$"def description;%;&;'i ;/0;T;T;T;:ValueDefinition;@P;IC;[o;
;o;;@ ;;;@
;="Amee::Model;;>;?@ ;@;@@;";IC;[ @H@S@Y@c;@@;'i;@};'io:+YARD::CodeObjects::ClassVariableObject ;@
; [; "@@logger = nil;: @@logger;"lib/amee/logging.rb;";$"@@logger = nil;'i o;;@
; [;3T; "#def self.logger
  @@logger
end;: logger;@q;";;";#T;$"def self.logger;%;&;'i o; ;
{;@
; [;3T;IC;{;IC;{;T;IC;{;T;T;: Logging;@q;IC;[;@y;";IC;[o;;@y; [; "def self.log_amee_api(method, parser_name, path, options)
  message = method
  dump = format_da_dump(parser_name, path, options)
  if block_given?
    result = nil
    seconds = Benchmark.realtime { result = yield }
    log_info(message, dump, seconds)
    result
  else
    log_info(message, dump)
    nil
  end
rescue Exception => e
  exception = "#{e.class.name}: #{e.message}: #{dump}"
  log_info(message, exception)
  raise
end;:log_amee_api;@q;";;";#T;$">def self.log_amee_api(method, parser_name, path, options);%;&;'io;;@y; [;3T; "kdef self.format_da_dump(parser_name, path, options)
  parser_name + path.inspect + options.inspect
end;:format_da_dump;@q;";;";#T;$"8def self.format_da_dump(parser_name, path, options);%;&;'i$o;;@y; [;3T; "def self.log_info(message, dump, seconds = 0)
  return unless Amee.logger
  log_message = "#{message} (#{seconds}) #{dump}"
  Amee.logger.info(log_message)
end;: log_info;@q;";;";#T;$"2def self.log_info(message, dump, seconds = 0);%;&;'i(;@y;'i@o;;@
; [; "adef session
  @session || (raise "Must bind this object to a Amee session before using")
end;: session;@;";;";#T;$"def session;%;&;'iPo;;@
; [;3T; "bdef initialize(hash = {}, session = nil)
  @session = session
  populate_from_hash!(hash)
end;:initialize;@;";;";#T;$"-def initialize(hash = {}, session = nil);%;&;'iTo;;@
; [;3T; "?def full_path
  self.class.path_prefix + resource_path
end;:full_path;@;";;";#T;$"def full_path;%;&;'iYo;;@
; [;3T; "Bdef populated?
  @populated && lazy_populators_populated?
end;:populated?;@;";;";#T;$"def populated?;%;&;'i]o;;@
; [o;* ;+["NotImplementError;,"
raise;0;-";3T; "fdef populate!
  raise NotImplementError, "#{self.class} included me and has not overriden me"
end;;H;@;";;";#T;$"def populate!;%;&;'iao;;@
; [;3T; "def populate_from_hash!(hash)
  unless hash.nil? || hash.empty?
    populate_paths(hash["resource_path"], hash["path"])
    hash.each do |key, value|
      set_attr_method = "#{Amee::Utils::String.snake_case(key)}="
      if !value.nil? && respond_to?(set_attr_method)
        self.__send__(set_attr_method, value)
      else
        # attempt to set attribute basically
      end
    end
    @populated = true
  end
end;:populate_from_hash!;@;";;";#T;$""def populate_from_hash!(hash);%;&;'ieo;;@
; [;3T; "fdef populate_paths(resource_path, path)
  self.resource_path, self.path = resource_path, path
end;:populate_paths;@;";;"we want the resource paths populated along with the path
 before we populate any other attribute as
they may use these attributes;#T;$",def populate_paths(resource_path, path);%;&;/0;'iwo;;@
; [;3T; "def lazy_populators_populated?
  if self.class.lazy_populators
    self.class.lazy_populators.find_all {|pop| !instance_variable_get("@#{pop}").nil?} == self.class.lazy_populators
  end
end;:lazy_populators_populated?;@;";;";#T;$"#def lazy_populators_populated?;%;&;'i{o; ;
{;@
;o;;@
;;;0; [;IC;{;IC;{;T;IC;{;T;T;: Parser;"lib/amee/parser.rb;IC;[;@;";IC;[o;;@; [; "gdef self.parse(method, data)
  parser = Parser::PARSERS[method]
  parser.process(
    data
  )
end;:
parse;@;";;";#T;$"!def self.parse(method, data);%;&;'io:&YARD::CodeObjects::ConstantObject ;@; [; "?PARSERS = { 'data.category' => DataCategory, 'data.item' => DataItem, "data.item_value" => DataItemValue, "raw" => Raw, "profiles" => Profiles, "create.profile" =>CreateProfile, "update.profile" => UpdateProfile, "delete.profile" => DeleteProfile, "create.profile_item" => CreateProfileItem, "profile_category" => ProfileCategory, "profile_item" => ProfileItem, "delete.profile_item" => DeleteProfileItem, "get.profile" => GetProfile, "profile.category" => ProfileCategory, "data.drill" => Drill };: PARSERS;@;";$":PARSERS = { 'data.category' => DataCategory, 'data.item' => DataItem, "data.item_value" => DataItemValue, "raw" => Raw, "profiles" => Profiles, "create.profile" =>CreateProfile, "update.profile" => UpdateProfile, "delete.profile" => DeleteProfile, "create.profile_item" => CreateProfileItem, "profile_category" => ProfileCategory, "profile_item" => ProfileItem, "delete.profile_item" => DeleteProfileItem, "get.profile" => GetProfile, "profile.category" => ProfileCategory, "data.drill" => Drill;'iy;@;'io; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;;<;@;IC;[;@;";IC;[o;;@; [; "def self.process(data)
  category = data["dataCategory"]
  parent_category = data["dataCategory"]["dataCategory"] if data["dataCategory"]
  categories = {"data_categories" => data["children"].delete("dataCategories")}
  data_items = {"data_items" => data["children"]["dataItems"].delete("rows")} if data["children"]["dataItems"]
  category.merge(categories).
  merge(data_items).
  merge({"resource_path" => data["path"]})
end;: process;@;";;";#T;$"def self.process(data);%;&;'i;@;'io; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;;Q;@;IC;[;@;";IC;[o;;@; [; "
def self.process(data)
  data_item = data["dataItem"]
  item_values = {"item_values" => data["dataItem"].delete("itemValues")}
  data_item.merge(item_values).
  merge({"choices" => data["userValueChoices"]["choices"]}).
  merge({"resource_path" => data["path"]})
end;;;@;";;";#T;$"def self.process(data);%;&;'i;@;'io; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;;`;@;IC;[;@;";IC;[o;;@; [; "{def self.process(data)
  data_item_value = data["itemValue"]
  data_item_value.merge({"resource_path" => data["path"]})
end;;;@;";;";#T;$"def self.process(data);%;&;'i';@;'i&o; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:
Drill;@;IC;[;@;";IC;[o;;@; [; "def self.process(data)
  choices = {"choices", data["choices"].delete("choices")}
  data.merge(choices).merge({"choice_name" => data["choices"].delete("name")})
end;;;@;";;";#T;$"def self.process(data);%;&;'i.;@;'i-o; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;: Profiles;@;IC;[;@;";IC;[o;;@; [; "2def self.process(data)
  data["profiles"]
end;;;@;";;";#T;$"def self.process(data);%;&;'i5;@;'i4o; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:ProfileCategory;@;IC;[;@;";IC;[o;;@; [; "&def self.process(data)
  profile_categories = {"profile_categories" => data["children"].delete("dataCategories")}
  profile_items = {"profile_items" => data["children"].delete("profileItems")}
  data.merge(profile_items).merge(profile_categories).
  merge({"resource_path" => data["path"]})
end;;;@;";;";#T;$"def self.process(data);%;&;'i;;@;'i:o; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:ProfileItem;@;IC;[;@-;";IC;[o;;@-; [; "^def self.process(data)
  data["profileItem"].merge({"resource_path" => data["path"]})
end;;;@;";;";#T;$"def self.process(data);%;&;'iD;@-;'iCo; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:CreateProfile;@;IC;[;@<;";IC;[o;;@<; [; "]def self.process(data)
  data["profile"].
  merge({"resource_path" => data["path"]})
end;;;@;";;";#T;$"def self.process(data);%;&;'iJ;@<;'iIo; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:UpdateProfile;@;IC;[;@K;";IC;[o;;@K; [; "]def self.process(data)
  data["profile"].
  merge({"resource_path" => data["path"]})
end;;;@;";;";#T;$"def self.process(data);%;&;'iQ;@K;'iPo; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:DeleteProfile;@;IC;[;@Z;";IC;[o;;@Z; [; "&def self.process(data)
  data
end;;;@;";;";#T;$"def self.process(data);%;&;'iX;@Z;'iWo; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:GetProfile;@;IC;[;@i;";IC;[o;;@i; [; "def self.process(data)
  categories = {"profile_categories" => data["children"].delete("dataCategories")}
  data["profile"].merge(categories).
  merge({"resource_path" => data["path"]})
end;;;@;";;";#T;$"def self.process(data);%;&;'i^;@i;'i]o; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:CreateProfileItem;@;IC;[;@x;";IC;[o;;@x; [; "&def self.process(data)
  data
end;;;@;";;";#T;$"def self.process(data);%;&;'if;@x;'ieo; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:DeleteProfileItem;@;IC;[;@;";IC;[o;;@; [; "&def self.process(data)
  data
end;;;@;";;";#T;$"def self.process(data);%;&;'il;@;'iko; ;
{;@
;o;;@
;;|;@; [;IC;{;IC;{;T;IC;{;T;T;:Raw;@;IC;[;@;";IC;[o;;@; [; "&def self.process(data)
  data
end;;;@;";;";#T;$"def self.process(data);%;&;'is;@;'iro; ;
{;@
; [;IC;{;IC;{;T;IC;{;T;T;:ProfileApi;"$lib/amee/profile_api/profile.rb;IC;[;@;";IC;[o; ;
{;@;o;;@;;;0; [;IC;{;IC;{;T;IC;{:profile_dateIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"6the value to set the attribute +profile_date+ to.; "9def profile_date=(value)
  @profile_date = value
end;:profile_date=;@;";;"&Sets the attribute +profile_date+;$"def profile_date=(value);%;&;'i ;/0;0o;;@; [; ")def profile_date
  @profile_date
end;;;@;";;"2Returns the value of attribute +profile_date+;$"def profile_date;%;&;'i ;/0;T:amount_per_monthIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-":the value to set the attribute +amount_per_month+ to.; "Adef amount_per_month=(value)
  @amount_per_month = value
end;:amount_per_month=;@;";;"*Sets the attribute +amount_per_month+;$"!def amount_per_month=(value);%;&;'i ;/0;0o;;@; [; "1def amount_per_month
  @amount_per_month
end;;;@;";;"6Returns the value of attribute +amount_per_month+;$"def amount_per_month;%;&;'i ;/0;T;T;T;: Profile;@;IC;[o;
;o;;@ ;;;@
;="Amee::Model;;>;?@ ;@;@;";IC;[@@@@o;;@; [; "Pdef self.create(session)
  self.from_hash(session.new_profile, session)
end;: create;@;";;";#T;$"def self.create(session);%;&;'io;;@; [;3T; "def create_profile_data_item(path_or_category, data_item_uid, params = {})
  path = self.full_path + path_or_category.is_a?(String) ? "/#{path_or_category}" : "/#{path_or_category.full_path}"
  Amee::ProfileApi::ProfileDataItem.create(session, path, data_item_uid, params)
end;:create_profile_data_item;@;";;";#T;$"Odef create_profile_data_item(path_or_category, data_item_uid, params = {});%;&;'io;;@; [;3T; "[def get_profile_item(path, options = {})
  session.get_profile_item(path, options)
end;:get_profile_item;@;";;";#T;$"-def get_profile_item(path, options = {});%;&;'io;;@; [;3T; "jdef update_profile_item(path, fields)
  session.update_profile_item(full_path, :fields => fields)
end;:update_profile_item;@;";;";#T;$"*def update_profile_item(path, fields);%;&;'io;;@; [;3T; "7def destroy
  session.delete_profile(self.uid)
end;: destroy;@;";;";#T;$"def destroy;%;&;'i"o;;@; [;3T; "@def full_path
  "#{self.class.path_prefix}/#{self.uid}"
end;;|;@;";;";#T;$"def full_path;%;&;'i&;@;'i o; ;
{;@;o;;@;;;0; [;IC;{;IC;{;T;IC;{: profileIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"1the value to set the attribute +profile+ to.; "/def profile=(value)
  @profile = value
end;: profile=;"-lib/amee/profile_api/profile_category.rb;";;"!Sets the attribute +profile+;$"def profile=(value);%;&;'i;/0;0o;;@; [; "def profile
  @profile
end;;;@
;";;"-Returns the value of attribute +profile+;$"def profile;%;&;'i;/0;T:total_amount_per_monthIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"@the value to set the attribute +total_amount_per_month+ to.; "Mdef total_amount_per_month=(value)
  @total_amount_per_month = value
end;:total_amount_per_month=;@
;";;"0Sets the attribute +total_amount_per_month+;$"'def total_amount_per_month=(value);%;&;'i;/0;0o;;@; [; "=def total_amount_per_month
  @total_amount_per_month
end;;;@
;";;"<Returns the value of attribute +total_amount_per_month+;$"def total_amount_per_month;%;&;'i;/0;T:total_amountIC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"6the value to set the attribute +total_amount+ to.; "9def total_amount=(value)
  @total_amount = value
end;:total_amount=;@
;";;"&Sets the attribute +total_amount+;$"def total_amount=(value);%;&;'i;/0;0o;;@; [; ")def total_amount
  @total_amount
end;;;@
;";;"2Returns the value of attribute +total_amount+;$"def total_amount;%;&;'i;/0;T;T;T;;;@
;IC;[o;
;o;;@ ;;;@
;="Amee::Model;;>;?@ ;@;@;";IC;[@@ @@@#@-o;;@; [; "def populate!
  session.api_call(:get, "profile.category", self.full_path) do |response|
    populate_from_hash!(response)
  end
end;;H;@
;";;";#T;$"def populate!;%;&;'io;;@; [;3T; ")def profile_uid
  profile["uid"]
end;:profile_uid;@
;";;";#T;$"def profile_uid;%;&;'io;;@; [;3T; "2def total_co2_unit
  total_amount["unit"]
end;:total_co2_unit;@
;";;";#T;$"def total_co2_unit;%;&;'i o;;@; [;3T; "4def total_co2_value
  total_amount["value"]
end;:total_co2_value;@
;";;";#T;$"def total_co2_value;%;&;'i$o;;@; [;3T; "Sdef full_path
  "#{self.class.path_prefix}/#{profile_uid}" + resource_path
end;;|;@
;";;";#T;$"def full_path;%;&;'i(;@;'i
o; ;
{;@;o;;@;;;0; [;IC;{;IC;{;T;IC;{;RIC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-"3the value to set the attribute +data_item+ to.; "3def data_item=(value)
  @data_item = value
end;;S;")lib/amee/profile_api/profile_item.rb;";;"#Sets the attribute +data_item+;$"def data_item=(value);%;&;'i;/0;0o;;@Q; [; "#def data_item
  @data_item
end;;R;@a;";;"/Returns the value of attribute +data_item+;$"def data_item;%;&;'i;/0;T;IC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-"1the value to set the attribute +profile+ to.; "/def profile=(value)
  @profile = value
end;;;@a;";;"!Sets the attribute +profile+;$"def profile=(value);%;&;'i;/0;0o;;@Q; [; "def profile
  @profile
end;;;@a;";;"-Returns the value of attribute +profile+;$"def profile;%;&;'i;/0;T;IC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-"6the value to set the attribute +total_amount+ to.; "9def total_amount=(value)
  @total_amount = value
end;;;@a;";;"&Sets the attribute +total_amount+;$"def total_amount=(value);%;&;'i;/0;0o;;@Q; [; ")def total_amount
  @total_amount
end;;;@a;";;"2Returns the value of attribute +total_amount+;$"def total_amount;%;&;'i;/0;T;KIC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-"4the value to set the attribute +start_date+ to.; "5def start_date=(value)
  @start_date = value
end;;L;@a;";;"$Sets the attribute +start_date+;$"def start_date=(value);%;&;'i;/0;0o;;@Q; [; "%def start_date
  @start_date
end;;K;@a;";;"0Returns the value of attribute +start_date+;$"def start_date;%;&;'i;/0;T:endIC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-"-the value to set the attribute +end+ to.; "'def end=(value)
  @end = value
end;: end=;@a;";;"Sets the attribute +end+;$"def end=(value);%;&;'i;/0;0o;;@Q; [; "def end
  @end
end;;;@a;";;")Returns the value of attribute +end+;$" def end;%;&;'i;/0;T;IC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-":the value to set the attribute +amount_per_month+ to.; "Adef amount_per_month=(value)
  @amount_per_month = value
end;;;@a;";;"*Sets the attribute +amount_per_month+;$"!def amount_per_month=(value);%;&;'i;/0;0o;;@Q; [; "1def amount_per_month
  @amount_per_month
end;;;@a;";;"6Returns the value of attribute +amount_per_month+;$"def amount_per_month;%;&;'i;/0;T: amountIC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-"0the value to set the attribute +amount+ to.; "-def amount=(value)
  @amount = value
end;: amount=;@a;";;" Sets the attribute +amount+;$"def amount=(value);%;&;'i;/0;0o;;@Q; [; "def amount
  @amount
end;;;@a;";;",Returns the value of attribute +amount+;$"def amount;%;&;'i;/0;T;MIC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-"2the value to set the attribute +end_date+ to.; "1def end_date=(value)
  @end_date = value
end;;N;@a;";;""Sets the attribute +end_date+;$"def end_date=(value);%;&;'i;/0;0o;;@Q; [; "!def end_date
  @end_date
end;;M;@a;";;".Returns the value of attribute +end_date+;$"def end_date;%;&;'i;/0;T:valid_fromIC;{;)o;;@Q; [o;* ;+[;,"
param;"
value;-"4the value to set the attribute +valid_from+ to.; "5def valid_from=(value)
  @valid_from = value
end;:valid_from=;@a;";;"$Sets the attribute +valid_from+;$"def valid_from=(value);%;&;'i;/0;0o;;@Q; [; "%def valid_from
  @valid_from
end;;;@a;";;"0Returns the value of attribute +valid_from+;$"def valid_from;%;&;'i;/0;T;T;T;;;@a;IC;[o;
;o;;@Q;;;@
;="Amee::Model;;>;?@Q;@;@Q;";IC;[@@@@@Y@d@j@t@@@@@@@@@z@o;;@Q; [; "def self.create(session, path, data_item_uid, fields ={})
  hash = session.create_profile_data_category(path, data_item_uid, :fields => fields)
  self.from_hash(hash, session)
end;;;@a;";;";#T;$">def self.create(session, path, data_item_uid, fields ={});%;&;'io;;@Q; [;3T; "\def update(fields)
  session.update_profile_item(self.full_path, :fields => fields)
end;: update;@a;";;";#T;$"def update(fields);%;&;'io;;@Q; [;3T; "Bdef destroy
  session.delete_profile_item(self.full_path)
end;;;@a;";;";#T;$"def destroy;%;&;'io;;@Q; [;3T; "&def co2_unit
  amount["unit"]
end;: co2_unit;@a;";;";#T;$"def co2_unit;%;&;'i"o;;@Q; [;3T; "(def co2_value
  amount["value"]
end;:co2_value;@a;";;";#T;$"def co2_value;%;&;'i&o;;@Q; [;3T; ")def profile_uid
  profile["uid"]
end;;;@a;";;";#T;$"def profile_uid;%;&;'i*o;;@Q; [;3T; "Sdef full_path
  "#{self.class.path_prefix}/#{profile_uid}" + resource_path
end;;|;@a;";;";#T;$"def full_path;%;&;'i.;@Q;'i
;@;'io; ;
{;@
;o;;@
;;;0; [;IC;{;IC;{;T;IC;{;T;T;: Service;"lib/amee/service.rb;IC;[o;;@;: HTTParty;0;@;";IC;[o;;@; [; ">def initialize(auth_token)
  @auth_token = auth_token
end;;{;@;";;";#T;$"def initialize(auth_token);%;&;'i o;;@; [;3T; "]def post(method, path, options = {})
  perform_request(:post, method, path, options)
end;: post;@;";;";#T;$")def post(method, path, options = {});%;&;'io;;@; [;3T; "[def get(method, path, options = {})
  perform_request(:get, method, path, options)
end;:get;@;";;";#T;$"(def get(method, path, options = {});%;&;'io;;@; [;3T; "[def put(method, path, options = {})
  perform_request(:put, method, path, options)
end;:put;@;";;";#T;$"(def put(method, path, options = {});%;&;'io;;@; [;3T; "adef delete(method, path, options = {})
  perform_request(:delete, method, path, options)
end;;8;@;";;";#T;$"+def delete(method, path, options = {});%;&;'io;;@; [;3T; "def self.auth_token(username, password, path)
  response = Net::HTTP.post_form(
    URI.parse(self.base_uri + path),
    {'username'=> username, 'password'=>password}
  )
  response['authToken']
end;:auth_token;@;";;";#T;$"2def self.auth_token(username, password, path);%;&;'i!o;;@; [;3T; "def perform_request(type, method, path, options)
  attach_headers(options)
  response = self.class.send(type, path, options)
  check_response(response.code)
  Parser.parse(method, response)
end;:perform_request;@;";;"dwe want to attach the authToken to the headers of the request
 and then check the status code;#T;$"5def perform_request(type, method, path, options);%: private;/0;'i,o;;@; [;3T; "def attach_headers(options)
  (options[:headers] ||= {}).merge!(
    {
      "authToken" => @auth_token,
      'Accept' => options[:accept] || Amee::Config[:accept]
    }
  )
end;:attach_headers;@;";;";#T;$" def attach_headers(options);%;;'i3o;;@; [o;* ;+["Amee::PermissionDenied;,"
raise;0;-"if the status code is 403o;* ;+["Amee::UnAuthorized;,"
raise;0;-"+if a auth_token could not be generatedo;* ;+["Amee::SessionExpired;,"
raise;0;-"if a we get a 401;3T; "Qdef check_response(code)
  case code.to_s
    when "403"
      raise Amee::Session::PermissionDenied.new("You do not have permission to perform the requested operation")
    when "401"
      raise Amee::Session::Expired.new("Session has expired")
    when "404"
      raise Amee::Session::NotFound.new("resource was not found")
  end
end;:check_response;@;";;"j checking the status code of the response; if we are not authenticated
then authenticate the session;#T;$"def check_response(code);%;;/0;'iB;@;'i@o; ;
{;@
; [;IC;{;IC;{;T;IC;{;T;T;:
Utils;"lib/amee/utils/string.rb;IC;[;@Z;";IC;[o; ;
{;@Z;o;;@Z;;;0; [;IC;{;IC;{;T;IC;{;T;T;: String;@`;IC;[;@d;";IC;[o;;@d; [; "def self.snake_case(string)
  return string.downcase if string =~ /^[A-Z]+$/
  string.gsub(/([A-Z]+)(?=[A-Z][a-z]?)|\B[A-Z]/, '_\&') =~ /_*(.*)/
    return $+.downcase
end;:snake_case;@`;";;";#T;$" def self.snake_case(string);%;&;'i ;@d;'i;@Z;'io;~ ;@
; [; "VERSION = '0.0.1';: VERSION;"lib/amee.rb;";$"VERSION = '0.0.1';'i';@
;'i;o;;@
;;;0; [;IC;{;IC;{;T;IC;{;IC;{;)o;;@; [o;* ;+[;,"
param;"
value;-"4the value to set the attribute +auth_token+ to.; "5def auth_token=(value)
  @auth_token = value
end;:auth_token=;"lib/amee/session.rb;";;"$Sets the attribute +auth_token+;$"def auth_token=(value);%;&;'i;/0;0o;;@; [; "%def auth_token
  @auth_token
end;;;@;";;"0Returns the value of attribute +auth_token+;$"def auth_token;%;&;'i;/0;T;T;T;: Session;@;IC;[;@;";IC;[#o; ;
{;@;o;;@;:StandardError;0; [;IC;{;IC;{;T;IC;{;T;T;: Expired;@;IC;[;@;";IC;[;@;'i o; ;
{;@;o;;@;;;0; [;IC;{;IC;{;T;IC;{;T;T;:UnAuthorized;@;IC;[;@;";IC;[;@;'i
o; ;
{;@;o;;@;;;0; [;IC;{;IC;{;T;IC;{;T;T;:NotAuthenticated;@;IC;[;@;";IC;[;@;'i o; ;
{;@;o;;@;;;0; [;IC;{;IC;{;T;IC;{;T;T;:PermissionDenied;@;IC;[;@;";IC;[;@;'i o; ;
{;@;o;;@;;;0; [;IC;{;IC;{;T;IC;{;T;T;: NotFound;@;IC;[;@;";IC;[;@;'i @@o;;@; [o;* ;+["ArgumentError;,"
raise;0;-"; "def self.create(username = nil, password = nil)
  usename ||= Amee::Config[:username]
  password ||= Amee::Config[:password]
  raise ArgumentError unless !username.nil? && !password.nil?
  new(username, password)
end;;;@;";;";#T;$"4def self.create(username = nil, password = nil);%;&;'io;;@; [;3T; "def initialize(username, password, authenticate = true)
  @username = username
  @password = password
  authenticate! if authenticate
end;;{;@;";;";#T;$"<def initialize(username, password, authenticate = true);%;&;'io;;@; [;3T; "def authenticate!
  @auth_token = nil
  unless @auth_token = Amee::Service.auth_token(@username, @password, Amee::Config[:auth_path])
    raise Amee::Session::UnAuthorized.new "Please provide your correct username and password. "
  end
end;:authenticate!;@;";;";#T;$"def authenticate!;%;&;'io;;@; [;3T; "/def authenticated?
  !@auth_token.nil?
end;:authenticated?;@;";;";#T;$"def authenticated?;%;&;'i$o;;@; [;3T; "def service
  if authenticated?
    @service ||= Amee::Service.new(@auth_token)
  else
    raise Amee::Session::NotAuthenticated.new "Session is not authenticated"
  end
end;: service;@;";;";#T;$"def service ;%;&;'i(o;;@; [;3T; "def api_call_without_logging(method, parser_name, path, options ={}, use_auth_token =true, &proc)
  result = service.send(method, parser_name, path, options)
  result = yield result if block_given?
  result
end;:api_call_without_logging;@;";;";#T;$"fdef api_call_without_logging(method, parser_name, path, options ={}, use_auth_token =true, &proc);%;&;'i0o;;@; [;3T; "def api_call(method, parser_name, path, options ={}, use_auth_token =true, &proc)
  if cache = cache(method, path, options)
    return cache
  else
    attempts = 0
    begin
      if Amee::Config[:logging]
        Amee::Logging.log_amee_api(method, parser_name, path, options) do
          api_call_without_logging(method, parser_name, path, options, use_auth_token =true, &proc)
        end
      else
        api_call_without_logging(method, parser_name, path, options, use_auth_token =true, &proc)
      end
    rescue Amee::Session::Expired
      attempts +=1
      if attempts < 2
        self.authenticate!
        retry
      else
        raise
      end
    end
  end
end;: api_call;@;";;"CWOOOOOOOOOOO TIDY ME PLEASE HORRIBELIMBLE
WHAT THE EGG IS THIS;#T;$"Vdef api_call(method, parser_name, path, options ={}, use_auth_token =true, &proc);%;&;/0;'i8o;;@; [o;* ;+[" Amee::DataApi::DataCategory;," return;0;-";3T; "def get_data_category(path, options = {})
  api_call(:get, "data.category", path) do |response|
    Amee::DataApi::DataCategory.from_hash(response, self)
  end
end;:get_data_category;@;";;";#T;$".def get_data_category(path, options = {});%;&;/0;'iRo;;@; [o;* ;+["Amee::DataApi::DrillDown;," return;0;-";3T; "def drill(path, options = {})
  api_call(:get, "data.drill", "#{path}/drill", :query => options[:selections]) do |response|
    Amee::DataApi::DrillDown.from_hash(response, self)
  end
end;;F;@;";;";#T;$""def drill(path, options = {});%;&;/0;'iYo;;@; [o;* ;+["Amee::DataApi::DataItem;," return;0;-";3T; "def get_data_item(path, options = {})
  api_call(:get, "data.item", path) do |response|
    Amee::DataApi::DataItem.from_hash(response, self)
  end
end;:get_data_item;@;";;";#T;$"*def get_data_item(path, options = {});%;&;/0;'i`o;;@; [o;* ;+["!Amee::DataApi::DataItemValue;," return;0;-";3T; "def get_data_item_value(path, options ={})
  api_call(:get, "data.item_value", path) do |response|
    Amee::DataApi::DataItemValue.from_hash(response, self)
  end
end;:get_data_item_value;@;";;";#T;$"/def get_data_item_value(path, options ={});%;&;/0;'igo;;@; [o;* ;+["Amee::ProfileApi::Profile;," return;0;-";3T; "def create_profile
  api_call(:post, "create.profile", "/profiles", :query => {:profile => true}) do |response|
    Amee::ProfileApi::Profile.from_hash(response, self)
  end
end;:create_profile;@;";;";#T;$"def create_profile;%;&;/0;'ino;;@; [o;* ;+["Amee::ProfileApi::Profile;," return;0;-";3T; "def get_profile(uid)
  api_call(:get, "get.profile", "/profiles/#{uid}") do |response|
    Amee::ProfileApi::Profile.from_hash(response, self)
  end
end;:get_profile;@;";;";#T;$"def get_profile(uid);%;&;/0;'iuo;;@; [o;* ;+[""Amee::ProfileApi::ProfileItem;," return;0;-";3T; "def update_profile_item(path, options = {})
  api_call(:put, "profile_item", path,
    :query => {:representation => options[:representation] || true}.merge(options[:fields])) do |response|
    Amee::ProfileApi::ProfileItem.from_hash(response, self)
  end
end;;;@;";;";#T;$"0def update_profile_item(path, options = {});%;&;/0;'i|o;;@; [o;* ;+[" String;," return;0;-" locaion of the new resource;3T; "def create_profile_item(path, uid, options = {})
  api_call(:post, "create.profile_item", path,
    :query => {:dataItemUid => uid}.merge(options[:fields])) do |response|
      location = response.headers["location"]
      location.is_a?(Array) ? location.first : location
    end
end;:create_profile_item;@;";;";#T;$"5def create_profile_item(path, uid, options = {});%;&;/0;'io;;@; [o;* ;+[" Hash;," return;0;-";3T; "def new_profile
  api_call(:post, "create.profile", "/profiles", :query => {:profile => true}) do |response|
    response
  end
end;:new_profile;@;";;"Ddoes not create a profile object compared to the create version;#T;$"def new_profile;%;&;/0;'io;;@; [o;* ;+[" Boolean;," return;0;-";3T; "wdef delete_profile(uid)
  api_call(:delete, "delete.profile", "/profiles/#{uid}") do |response|
    true
  end
end;:delete_profile;@;";;";#T;$"def delete_profile(uid);%;&;/0;'io;;@; [o;* ;+[" Boolean;," return;0;-";3T; "tdef delete_profile_item(path)
  api_call(:delete, "delete.profile_item", path) do |response|
    true
  end
end;:delete_profile_item;@;";;";#T;$""def delete_profile_item(path);%;&;/0;'io;;@; [o;* ;+["&Amee::ProfileApi::ProfileCategory;," return;0;-";3T; "def get_profile_category(path, options = {})
  api_call(:get, "profile_category", path, options) do |response|
    Amee::ProfileApi::ProfileCategory.from_hash(response, self)
  end
end;:get_profile_category;@;";;";#T;$"1def get_profile_category(path, options = {});%;&;/0;'i@o;;@; [o;* ;+["Array[Amee::Profile;," return;0;-"];3T; "def profiles
  api_call(:get, "profiles", "/profiles") do |response|
    response.map do |profile|
      Amee::ProfileApi::Profile.from_hash(profile, self) unless profile.empty?
    end
  end
end;: profiles;@;";;";#T;$"def profiles;%;&;/0;'io;;@; [o;* ;+[" Hash;," return;0;-";3T; "Fdef get_raw(path, options = {})
  api_call(:get, "raw", path)
end;: get_raw;@;";;";#T;$"$def get_raw(path, options = {});%;&;/0;'io;;@; [;3T; "/def cache(method, path, options)
  nil
end;:
cache;@;";;"TODO gonna be mostly using Moneta::Memory
but need to few apps before I can determine
 what sort of caching 1 requires basically;#T;$"%def cache(method, path, options);%;&;/0;'i;@;'i; [o;* ;+[""Amee::ProfileApi::ProfileItem;," return;0;-";3T; "def get_profile_item(path, options = {})
  api_call(:get, "profile_item", path, options) do |response|
    Amee::ProfileApi::ProfileItem.from_hash(response, self)
  end
end;;;@;";;";#T;$"-def get_profile_item(path, options = {});%;&;/0;'i:Amee::Session::NotFound@:Amee::DeleteProfileItem@:(Amee::DataApi::DataItemValue#value=@V:$Amee#lazy_populators_populated?@:&Amee::Session#get_data_item_value@
:3Amee::ProfileApi::ProfileItem#amount_per_month@:Amee::Session#get_raw@n:Amee::Session::create@:Amee::Service#initialize@:6Amee::ProfileApi::ProfileCategory#total_co2_value@G:Amee::Raw@:Amee::Parser::parse@:Amee::@@logger@n:.Amee::DataApi::DataItemValue#display_name@p:Amee::Model@:+Amee::DataApi::DataItemValue#per_unit=@:)Amee::ProfileApi::ProfileItem#update@:2Amee::ProfileApi::Profile#update_profile_item@:(Amee::DataApi::DataItem#start_date=@:"Amee::Model#populator_getters@:Amee::Utils@Z:Amee::Service#get@(:"Amee::ProfileApi::ProfileItem@Q:Amee::Parser::PARSERS@:.Amee::DataApi::DataItemValue#display_path@:Amee::DataItem@:Amee::CLI::execute@':Amee::Logging@y:&Amee::Session#update_profile_item@(:Amee::Config::[]@c:%Amee::DataApi::DataItem#choices=@#:Amee::Session#service@:*Amee::ProfileApi::ProfileItem#amount=@:*Amee::DataApi::DrillDown#choice_name=@:!Amee::DataItemValue::process@: Amee::Config::configuration@>:+Amee::DataApi::DataItemValue#data_item@P:Amee::Session#new_profile@<:.Amee::ProfileApi::ProfileItem#profile_uid@:4Amee::ProfileApi::ProfileCategory#total_amount=@#:%Amee::DataApi::DataItem#end_date@:2Amee::DataApi::ItemValueDefinition#from_data=@+:.Amee::ProfileApi::ProfileItem#valid_from=@:0Amee::ProfileApi::Profile#amount_per_month=@:Amee::Logging::log_info@:.Amee::DataApi::DataCategory#data_category@:Amee::Drill::process@
:.Amee::ProfileApi::ProfileCategory#profile@ :Amee#populate!@:&Amee::DataApi::DataItem#populate!@8:$Amee::Session#get_data_category@:!Amee::Service#attach_headers@A:4Amee::ProfileApi::ProfileItem#amount_per_month=@:,Amee::ProfileApi::ProfileItem#data_item@d:+Amee::DataApi::DataCategory#can_drill?@:Amee::Profiles::process@:Amee::Model::ClassMethods@:%Amee::DataApi::DrillDown#choices@:'Amee::Session#get_profile_category@Z:$Amee::Session::PermissionDenied@:0Amee::ProfileApi::ProfileCategory#populate!@8;@
:#Amee::DataApi::ValueDefinition@@:/Amee::DataApi::DataItemValue#display_name=@f:Amee#populate_paths@: Amee::Session#get_data_item@:-Amee::ProfileApi::ProfileItem#start_date@:&Amee::ProfileApi::Profile::create@:#Amee::ProfileCategory::process@(:Amee::Session#profiles@d:5Amee::ProfileApi::ProfileCategory#total_co2_unit@B:/Amee::DataApi::DataItemValue#display_path=@v:Amee::CLI@:.Amee::DataApi::ValueDefinition#value_type@S:Amee::Session::Expired@:/Amee::ProfileApi::ProfileItem#total_amount@:/Amee::ProfileApi::Profile#get_profile_item@:.Amee::Model::ClassMethods#list_populators@:Amee::Config::[]=@s:"Amee::DataApi::ItemDefinition@:Amee::ProfileItem::process@7:Amee::Session#initialize@:Amee::Service#post@#:,Amee::DataApi::DataItemValue#data_item=@E:Amee::DataCategory@:-Amee::DataApi::DataItemValue#description@:!Amee::Config::configuration=@3:Amee::Session#get_profile@:*Amee::ProfileApi::ProfileItem#destroy@:Amee::Config::set@L:!Amee::CreateProfile::process@F:&Amee::DataApi::DataItem#end_date=@:-Amee::DataApi::ItemDefinition#drill_down@:!Amee::Session#authenticated?@:&Amee::DataApi::DataItemValue#unit@:Amee::DataItem::process@:/Amee::DataApi::DataCategory#data_category=@:&Amee::Session#create_profile_item@2:,Amee::ProfileApi::ProfileItem#co2_value@:/Amee::ProfileApi::ProfileCategory#profile=@:(Amee::ProfileApi::Profile#full_path@:!Amee::UpdateProfile::process@U:Amee#initialize@:Amee::Config::delete@x:Amee::Service#delete@2:-Amee::ProfileApi::ProfileItem#data_item=@Y:Amee::ProfileApi::Profile@:&Amee::DataApi::DrillDown#choices=@:Amee::Drill@:"Amee::Logging::format_da_dump@:Amee::DataApi::DrillDown@:,Amee::ProfileApi::ProfileItem#full_path@ :"Amee::DataApi::DataItem#label@: Amee::DataApi::DataCategory@:!Amee::DeleteProfile::process@d:Amee#populated?@:Amee::VERSION@s:Amee::Session#api_call@:"Amee::Service#perform_request@<:.Amee::ProfileApi::ProfileItem#start_date=@:&Amee::ProfileApi::ProfileItem#end@:Amee::Profiles@:&Amee::DataApi::DataCategory#drill@:&Amee::Session#delete_profile_item@P:$Amee::Session::NotAuthenticated@:=Amee::ProfileApi::ProfileCategory#total_amount_per_month@:/Amee::DataApi::ValueDefinition#value_type=@H:Amee::GetProfile::process@s:Amee#populate_from_hash!@:4Amee::DataApi::ItemValueDefinition#from_profile@%:!Amee::DataApi::DataItemValue@=:0Amee::ProfileApi::ProfileItem#total_amount=@z:*Amee::ProfileApi::ProfileItem#profile@t:+Amee::ProfileApi::Profile#profile_date@:(Amee::DataApi::DrillDown#selections@:Amee::ProfileCategory@:2Amee::ProfileApi::ProfileCategory#profile_uid@=:.Amee::DataApi::DataItemValue#description=@:%Amee::CreateProfileItem::process@:Amee::Session@:+Amee::ProfileApi::ProfileItem#end_date@:7Amee::ProfileApi::Profile#create_profile_data_item@:Amee::DataApi::DataItem@:.Amee::DataApi::ItemDefinition#drill_down=@:Amee::ProfileItem@-:.Amee::Model::ClassMethods#item_populators@:(Amee::DataApi::DrillDown#uid_found?@:Amee::Session#auth_token@:%Amee::DeleteProfileItem::process@:/Amee::DataApi::ValueDefinition#description@c:'Amee::DataApi::DataItemValue#unit=@:Amee::Parser@:!Amee::Session#create_profile@:*Amee::ProfileApi::ProfileItem::create@:Amee::CreateProfile@<:Amee::Config::defaults@G:Amee::Session#cache@x: Amee::Session#authenticate!@:0Amee::ProfileApi::ProfileCategory#full_path@L:Amee::Raw::process@: Amee::DataCategory::process@:Amee::logger@t:'Amee::DataApi::DataItemValue#value@`:+Amee::ProfileApi::ProfileItem#co2_unit@:&Amee::ProfileApi::Profile#destroy@:'Amee::DataApi::ItemValueDefinition@:Amee::Config::key?@^:Amee::UpdateProfile@K:#Amee::DataApi::DataItem#label=@:Amee#session@:Amee::Utils::String@d:Amee::Service#put@-:'Amee::ProfileApi::ProfileItem#end=@:Amee::ProfileApi@:Amee::DataItemValue@:Amee::Config@,: Amee::Logging::log_amee_api@:*Amee::DataApi::DataItemValue#per_unit@:>Amee::ProfileApi::ProfileCategory#total_amount_per_month=@:&Amee::ProfileApi::ProfileCategory@:Amee::DataApi@}:5Amee::DataApi::ItemValueDefinition#from_profile=@:Amee::DeleteProfile@Z:Amee#full_path@:'Amee::DataApi::DataItem#start_date@ ;@ :$Amee::Utils::String::snake_case@n:+Amee::Session#api_call_without_logging@:Amee::Service::auth_token@7:+Amee::ProfileApi::ProfileItem#profile=@j:,Amee::ProfileApi::Profile#profile_date=@:)Amee::DataApi::DrillDown#selections=@:!Amee::Session#delete_profile@F: Amee::Session::UnAuthorized@:Amee::Service@:$Amee::DataApi::DataItem#choices@-:Amee::GetProfile@i:,Amee::ProfileApi::ProfileItem#end_date=@:)Amee::ProfileApi::ProfileItem#amount@:Amee::Model::included@:)Amee::DataApi::DrillDown#choice_name@:Amee::Session#auth_token=@:3Amee::ProfileApi::ProfileCategory#total_amount@-:0Amee::DataApi::ValueDefinition#description=@Y:Amee::CreateProfileItem@x:1Amee::DataApi::ItemValueDefinition#from_data@5:Amee::Session#drill@:!Amee::Service#check_response@F:-Amee::ProfileApi::ProfileItem#valid_from@:/Amee::ProfileApi::Profile#amount_per_month@:(Amee::Model::ClassMethods#from_hash@:+Amee::DataApi::DrillDown#data_item_uid@:*Amee::DataApi::DataCategory#populate!@;T{ " Object;"StandardError;" HTTParty: module"Amee::Model;