This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TSheets::Model | |
| attr_accessor :cache, :_dynamic_accessors | |
| @@_models ||= {} | |
| @@_accessors ||= {} | |
| def initialize(hash = nil, options = {}) | |
| self.cache = options[:cache] || TSheets::SupplementalCache.new | |
| self._dynamic_accessors ||= [] | |
| self.class.mass_assign self, hash, self.cache, {} if hash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if data['supplemental_data'] | |
| data['supplemental_data'].inject({}) do |sum, parts| | |
| sum | |
| key, value = parts | |
| sum[key.to_sym] = value.values | |
| sum | |
| end | |
| else | |
| {} | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class KmlUpdateHandler(tornado.web.RequestHandler): | |
| counter = 0 | |
| timeout = 10 | |
| global_dict = {} | |
| lock = threading.Lock() | |
| @classmethod | |
| def add_to_global_dict(cls, reference, unique_id): | |
| cls.global_dict[unique_id] = reference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logger | |
| class Results(object): | |
| def __init__(self, url, options, model, bridge, cache, is_singleton = False, mode = "list") | |
| self.url = url | |
| self.options = options | |
| self.model = model | |
| self.name = "users" | |
| self.index = -1 | |
| self.loaded = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def load_next_batch | |
| response = self.bridge.next_batch(self.url, self.name, self.options, self.is_singleton) | |
| puts "Self.model" | |
| puts self.model | |
| batch = response[:items] | |
| self.has_more = !self.is_singleton && response[:has_more] | |
| if self.is_singleton | |
| self.loaded = [ self.model.from_raw(batch, self.cache, response[:supplemental] || {}) ] | |
| else | |
| self.loaded += batch.map { |o| self.model.from_raw(o, self.cache, response[:supplemental] || {}) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TSheets::Model | |
| def self.from_raw(hash, cache, supplemental = {}) | |
| instance = hash.inject self.new(cache) do |o, p| | |
| k, v = p | |
| casted = cast_raw(v, k, cache) | |
| has_key = o.attributes.keys.include? k | |
| if !has_key | |
| o.instance_variable_set "@#{k}".to_sym, casted | |
| o.define_singleton_method k do | |
| o.instance_variable_get "@#{k}".to_sym |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sample |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| import sys | |
| import getopt | |
| import optparse | |
| import commands | |
| import shlex | |
| def returnStatus(statusInfo,checkMode): | |
| statusResult = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Last login: Wed Apr 22 01:27:32 on ttys002 | |
| kannan@Kannans-MacBook-Pro: ~/ep/lg_chef | |
| $ bash test/scripts/run_tests.sh | |
| ==> portal-pull-requests-kiosk: VM not created. Moving on... | |
| ==> portal-pull-requests-display: VM not created. Moving on... | |
| ==> portal-pull-requests-nuc: VM not created. Moving on... | |
| ==> portal-pull-requests: VM not created. Moving on... | |
| Not managing knife client because => chef_zero | |
| All ssh keys presented below | |
| 4096 59:10:22:6f:0e:c5:ba:12:0e:34:f5:e3:7c:4b:7b:18 /Users/kannan/.ssh/id_rsa (RSA) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 4096 59:10:22:6f:0e:c5:ba:12:0e:34:f5:e3:7c:4b:7b:18 /Users/kannan/.ssh/id_rsa (RSA) | |
| Converting from raw image file="../files/ipxe.usb" to file="../files/ipxe_portal-pull-requests-nuc.vmdk"... | |
| Creating dynamic image with size 409600 bytes (1MB)... | |
| Timed out while waiting for the machine to boot. This means that | |
| Vagrant was unable to communicate with the guest machine within | |
| the configured ("config.vm.boot_timeout" value) time period. | |
| If you look above, you should be able to see the error(s) that | |
| Vagrant had when attempting to connect to the machine. These errors | |
| are usually good hints as to what may be wrong. |