megam_api 1.5.beta4 → 1.5.beta5
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.
- checksums.yaml +4 -4
 - data/lib/megam/api/version.rb +1 -1
 - data/lib/megam/core/assemblies.rb +187 -171
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0edfa7aca1cb129ca26f22abe2ba83bfb66bfcca
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2bc809055aef36959b7074b352f11fa8d845e397
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 57abf4e97ede9a0e9e0809b96b70f6cf42fc6660ba89d0815f2821b7823ee5a2695730582c9be0523349f9465e730bf3701e1705194e9ffe721a6d3b83c91ab4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 506a98809838c2b965762dc3df1f1eddcd8155de64b746ed826c992f1a51b31e8630299ffd2867bd644190971f1139e1b0b5fb6ab08a7f9046838f11d858ef66
         
     | 
    
        data/lib/megam/api/version.rb
    CHANGED
    
    
| 
         @@ -15,177 +15,193 @@ 
     | 
|
| 
       15 
15 
     | 
    
         
             
            #
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            module Megam
         
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
                class Assemblies < Megam::RestAdapter
         
     | 
| 
      
 19 
     | 
    
         
            +
                    def initialize(o)
         
     | 
| 
      
 20 
     | 
    
         
            +
                        @id = nil
         
     | 
| 
      
 21 
     | 
    
         
            +
                        @accounts_id = nil
         
     | 
| 
      
 22 
     | 
    
         
            +
                        @org_id = nil
         
     | 
| 
      
 23 
     | 
    
         
            +
                        @name = nil
         
     | 
| 
      
 24 
     | 
    
         
            +
                        @password = nil
         
     | 
| 
      
 25 
     | 
    
         
            +
                        @assemblies = []
         
     | 
| 
      
 26 
     | 
    
         
            +
                        @inputs = []
         
     | 
| 
      
 27 
     | 
    
         
            +
                        @created_at = nil
         
     | 
| 
      
 28 
     | 
    
         
            +
                        @some_msg = {}
         
     | 
| 
      
 29 
     | 
    
         
            +
                        super(o)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    def assemblies
         
     | 
| 
      
 33 
     | 
    
         
            +
                        self
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    def id(arg=nil)
         
     | 
| 
      
 37 
     | 
    
         
            +
                        if arg != nil
         
     | 
| 
      
 38 
     | 
    
         
            +
                            @id = arg
         
     | 
| 
      
 39 
     | 
    
         
            +
                        else
         
     | 
| 
      
 40 
     | 
    
         
            +
                            @id
         
     | 
| 
      
 41 
     | 
    
         
            +
                        end
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    def accounts_id(arg=nil)
         
     | 
| 
      
 45 
     | 
    
         
            +
                        if arg != nil
         
     | 
| 
      
 46 
     | 
    
         
            +
                            @accounts_id = arg
         
     | 
| 
      
 47 
     | 
    
         
            +
                        else
         
     | 
| 
      
 48 
     | 
    
         
            +
                            @accounts_id
         
     | 
| 
      
 49 
     | 
    
         
            +
                        end
         
     | 
| 
      
 50 
     | 
    
         
            +
                    end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                    def org_id(arg=nil)
         
     | 
| 
      
 53 
     | 
    
         
            +
                        if arg != nil
         
     | 
| 
      
 54 
     | 
    
         
            +
                            @org_id = arg
         
     | 
| 
      
 55 
     | 
    
         
            +
                        else
         
     | 
| 
      
 56 
     | 
    
         
            +
                            @org_id
         
     | 
| 
      
 57 
     | 
    
         
            +
                        end
         
     | 
| 
      
 58 
     | 
    
         
            +
                    end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                    def password(arg=nil)
         
     | 
| 
      
 61 
     | 
    
         
            +
                        if arg != nil
         
     | 
| 
      
 62 
     | 
    
         
            +
                            @password = arg
         
     | 
| 
      
 63 
     | 
    
         
            +
                        else
         
     | 
| 
      
 64 
     | 
    
         
            +
                            @password
         
     | 
| 
      
 65 
     | 
    
         
            +
                        end
         
     | 
| 
      
 66 
     | 
    
         
            +
                    end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                    def name(arg=nil)
         
     | 
| 
      
 69 
     | 
    
         
            +
                        if arg != nil
         
     | 
| 
      
 70 
     | 
    
         
            +
                            @name = arg
         
     | 
| 
      
 71 
     | 
    
         
            +
                        else
         
     | 
| 
      
 72 
     | 
    
         
            +
                            @name
         
     | 
| 
      
 73 
     | 
    
         
            +
                        end
         
     | 
| 
      
 74 
     | 
    
         
            +
                    end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                    def assemblies(arg=[])
         
     | 
| 
      
 77 
     | 
    
         
            +
                        if arg != []
         
     | 
| 
      
 78 
     | 
    
         
            +
                            @assemblies = arg
         
     | 
| 
      
 79 
     | 
    
         
            +
                        else
         
     | 
| 
      
 80 
     | 
    
         
            +
                            @assemblies
         
     | 
| 
      
 81 
     | 
    
         
            +
                        end
         
     | 
| 
      
 82 
     | 
    
         
            +
                    end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                    def inputs(arg=[])
         
     | 
| 
      
 85 
     | 
    
         
            +
                        if arg != []
         
     | 
| 
      
 86 
     | 
    
         
            +
                            @inputs = arg
         
     | 
| 
      
 87 
     | 
    
         
            +
                        else
         
     | 
| 
      
 88 
     | 
    
         
            +
                            @inputs
         
     | 
| 
      
 89 
     | 
    
         
            +
                        end
         
     | 
| 
      
 90 
     | 
    
         
            +
                    end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                    def created_at(arg=nil)
         
     | 
| 
      
 93 
     | 
    
         
            +
                        if arg != nil
         
     | 
| 
      
 94 
     | 
    
         
            +
                            @created_at = arg
         
     | 
| 
      
 95 
     | 
    
         
            +
                        else
         
     | 
| 
      
 96 
     | 
    
         
            +
                            @created_at
         
     | 
| 
      
 97 
     | 
    
         
            +
                        end
         
     | 
| 
      
 98 
     | 
    
         
            +
                    end
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
                    def error?
         
     | 
| 
      
 101 
     | 
    
         
            +
                        crocked  = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
         
     | 
| 
      
 102 
     | 
    
         
            +
                    end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                    def some_msg(arg=nil)
         
     | 
| 
      
 106 
     | 
    
         
            +
                        if arg != nil
         
     | 
| 
      
 107 
     | 
    
         
            +
                            @some_msg = arg
         
     | 
| 
      
 108 
     | 
    
         
            +
                        else
         
     | 
| 
      
 109 
     | 
    
         
            +
                            @some_msg
         
     | 
| 
      
 110 
     | 
    
         
            +
                        end
         
     | 
| 
      
 111 
     | 
    
         
            +
                    end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
                    # Transform the ruby obj ->  to a Hash
         
     | 
| 
      
 115 
     | 
    
         
            +
                    def to_hash
         
     | 
| 
      
 116 
     | 
    
         
            +
                        index_hash = Hash.new
         
     | 
| 
      
 117 
     | 
    
         
            +
                        index_hash["json_claz"] = self.class.name
         
     | 
| 
      
 118 
     | 
    
         
            +
                        index_hash["id"] = id
         
     | 
| 
      
 119 
     | 
    
         
            +
                        index_hash["org_id"] = org_id
         
     | 
| 
      
 120 
     | 
    
         
            +
                        index_hash["name"] = name
         
     | 
| 
      
 121 
     | 
    
         
            +
                        index_hash["accounts_id"] = accounts_id
         
     | 
| 
      
 122 
     | 
    
         
            +
                        index_hash["inputs"] = inputs
         
     | 
| 
      
 123 
     | 
    
         
            +
                        index_hash["assemblies"] = assemblies
         
     | 
| 
      
 124 
     | 
    
         
            +
                        index_hash["created_at"] = created_at
         
     | 
| 
      
 125 
     | 
    
         
            +
                        index_hash["some_msg"] = some_msg
         
     | 
| 
      
 126 
     | 
    
         
            +
                        index_hash
         
     | 
| 
      
 127 
     | 
    
         
            +
                    end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                    # Serialize this object as a hash: called from JsonCompat.
         
     | 
| 
      
 130 
     | 
    
         
            +
                    # Verify if this called from JsonCompat during testing.
         
     | 
| 
      
 131 
     | 
    
         
            +
                    def to_json(*a)
         
     | 
| 
      
 132 
     | 
    
         
            +
                        for_json.to_json(*a)
         
     | 
| 
      
 133 
     | 
    
         
            +
                    end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                    def for_json
         
     | 
| 
      
 136 
     | 
    
         
            +
                        result = {
         
     | 
| 
      
 137 
     | 
    
         
            +
                            "id" => id,
         
     | 
| 
      
 138 
     | 
    
         
            +
                            "name" => name,
         
     | 
| 
      
 139 
     | 
    
         
            +
                            "accounts_id" => accounts_id,
         
     | 
| 
      
 140 
     | 
    
         
            +
                            "org_id" => org_id,
         
     | 
| 
      
 141 
     | 
    
         
            +
                            "assemblies" => assemblies,
         
     | 
| 
      
 142 
     | 
    
         
            +
                            "inputs" => inputs,
         
     | 
| 
      
 143 
     | 
    
         
            +
                            "created_at" => created_at
         
     | 
| 
      
 144 
     | 
    
         
            +
                        }
         
     | 
| 
      
 145 
     | 
    
         
            +
                        result
         
     | 
| 
      
 146 
     | 
    
         
            +
                    end
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
                    def self.json_create(o)
         
     | 
| 
      
 149 
     | 
    
         
            +
                        asm = new({})
         
     | 
| 
      
 150 
     | 
    
         
            +
                        asm.id(o["id"]) if o.has_key?("id")
         
     | 
| 
      
 151 
     | 
    
         
            +
                        asm.name(o["name"]) if o.has_key?("name")
         
     | 
| 
      
 152 
     | 
    
         
            +
                        asm.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
         
     | 
| 
      
 153 
     | 
    
         
            +
                        asm.org_id(o["org_id"]) if o.has_key?("org_id")
         
     | 
| 
      
 154 
     | 
    
         
            +
                        asm.assemblies(o["assemblies"]) if o.has_key?("assemblies") #this will be an array? can hash store array?
         
     | 
| 
      
 155 
     | 
    
         
            +
                        asm.inputs(o["inputs"]) if o.has_key?("inputs")
         
     | 
| 
      
 156 
     | 
    
         
            +
                        asm.created_at(o["created_at"]) if o.has_key?("created_at")
         
     | 
| 
      
 157 
     | 
    
         
            +
                        asm.some_msg[:code] = o["code"] if o.has_key?("code")
         
     | 
| 
      
 158 
     | 
    
         
            +
                        asm.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
         
     | 
| 
      
 159 
     | 
    
         
            +
                        asm.some_msg[:msg]= o["msg"] if o.has_key?("msg")
         
     | 
| 
      
 160 
     | 
    
         
            +
                        asm.some_msg[:links] = o["links"] if o.has_key?("links")
         
     | 
| 
      
 161 
     | 
    
         
            +
                        asm
         
     | 
| 
      
 162 
     | 
    
         
            +
                    end
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
                    def self.from_hash(o)
         
     | 
| 
      
 165 
     | 
    
         
            +
                        asm = self.new(o)
         
     | 
| 
      
 166 
     | 
    
         
            +
                        asm.from_hash(o)
         
     | 
| 
      
 167 
     | 
    
         
            +
                        asm
         
     | 
| 
      
 168 
     | 
    
         
            +
                    end
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
                    def from_hash(o)
         
     | 
| 
      
 171 
     | 
    
         
            +
                        @id                = o[:id] if o.has_key?(:id)
         
     | 
| 
      
 172 
     | 
    
         
            +
                        @name              = o[:name] if o.has_key?(:name)
         
     | 
| 
      
 173 
     | 
    
         
            +
                        @accounts_id       = o[:accounts_id] if o.has_key?(:accounts_id)
         
     | 
| 
      
 174 
     | 
    
         
            +
                        @org_id            = o[:org_id] if o.has_key?(:org_id)
         
     | 
| 
      
 175 
     | 
    
         
            +
                        @assemblies        = o[:assemblies] if o.has_key?(:assemblies)
         
     | 
| 
      
 176 
     | 
    
         
            +
                        @inputs            = o[:inputs] if o.has_key?(:inputs)
         
     | 
| 
      
 177 
     | 
    
         
            +
                        @created_at        = o[:created_at] if o.has_key?(:created_at)
         
     | 
| 
      
 178 
     | 
    
         
            +
                        self
         
     | 
| 
      
 179 
     | 
    
         
            +
                    end
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                    def self.create(params)
         
     | 
| 
      
 182 
     | 
    
         
            +
                        asm = from_hash(params)
         
     | 
| 
      
 183 
     | 
    
         
            +
                        asm.create
         
     | 
| 
      
 184 
     | 
    
         
            +
                    end
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
                    # Create the node via the REST API
         
     | 
| 
      
 187 
     | 
    
         
            +
                    def create
         
     | 
| 
      
 188 
     | 
    
         
            +
                        megam_rest.post_assemblies(to_hash)
         
     | 
| 
      
 189 
     | 
    
         
            +
                    end
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                    # Load a account by email_p
         
     | 
| 
      
 192 
     | 
    
         
            +
                    def self.show(o)
         
     | 
| 
      
 193 
     | 
    
         
            +
                        asm = self.new(o)
         
     | 
| 
      
 194 
     | 
    
         
            +
                        asm.megam_rest.get_one_assemblies(o[:assemblies_id])
         
     | 
| 
      
 195 
     | 
    
         
            +
                    end
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
                    def self.list(params)
         
     | 
| 
      
 198 
     | 
    
         
            +
                        asm = self.new(params)
         
     | 
| 
      
 199 
     | 
    
         
            +
                        asm.megam_rest.get_assemblies
         
     | 
| 
      
 200 
     | 
    
         
            +
                    end
         
     | 
| 
      
 201 
     | 
    
         
            +
             
     | 
| 
      
 202 
     | 
    
         
            +
                    def to_s
         
     | 
| 
      
 203 
     | 
    
         
            +
                        Megam::Stuff.styled_hash(to_hash)
         
     | 
| 
      
 204 
     | 
    
         
            +
                    end
         
     | 
| 
       102 
205 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
                # Transform the ruby obj ->  to a Hash
         
     | 
| 
       104 
     | 
    
         
            -
                def to_hash
         
     | 
| 
       105 
     | 
    
         
            -
                  index_hash = Hash.new
         
     | 
| 
       106 
     | 
    
         
            -
                  index_hash["json_claz"] = self.class.name
         
     | 
| 
       107 
     | 
    
         
            -
                  index_hash["id"] = id
         
     | 
| 
       108 
     | 
    
         
            -
                  index_hash["org_id"] = org_id
         
     | 
| 
       109 
     | 
    
         
            -
                  index_hash["name"] = name
         
     | 
| 
       110 
     | 
    
         
            -
                  index_hash["accounts_id"] = accounts_id
         
     | 
| 
       111 
     | 
    
         
            -
                  index_hash["inputs"] = inputs
         
     | 
| 
       112 
     | 
    
         
            -
                  index_hash["assemblies"] = assemblies
         
     | 
| 
       113 
     | 
    
         
            -
                  index_hash["created_at"] = created_at
         
     | 
| 
       114 
     | 
    
         
            -
                  index_hash
         
     | 
| 
       115 
206 
     | 
    
         
             
                end
         
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
                # Serialize this object as a hash: called from JsonCompat.
         
     | 
| 
       118 
     | 
    
         
            -
                # Verify if this called from JsonCompat during testing.
         
     | 
| 
       119 
     | 
    
         
            -
                def to_json(*a)
         
     | 
| 
       120 
     | 
    
         
            -
                  for_json.to_json(*a)
         
     | 
| 
       121 
     | 
    
         
            -
                end
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
                def for_json
         
     | 
| 
       124 
     | 
    
         
            -
                  result = {
         
     | 
| 
       125 
     | 
    
         
            -
                    "id" => id,
         
     | 
| 
       126 
     | 
    
         
            -
                    "name" => name,
         
     | 
| 
       127 
     | 
    
         
            -
                    "accounts_id" => accounts_id,
         
     | 
| 
       128 
     | 
    
         
            -
                    "org_id" => org_id,
         
     | 
| 
       129 
     | 
    
         
            -
                    "assemblies" => assemblies,
         
     | 
| 
       130 
     | 
    
         
            -
                    "inputs" => inputs,
         
     | 
| 
       131 
     | 
    
         
            -
                    "created_at" => created_at
         
     | 
| 
       132 
     | 
    
         
            -
                  }
         
     | 
| 
       133 
     | 
    
         
            -
                  result
         
     | 
| 
       134 
     | 
    
         
            -
                end
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
                def self.json_create(o)
         
     | 
| 
       137 
     | 
    
         
            -
                  asm = new({})
         
     | 
| 
       138 
     | 
    
         
            -
                  asm.id(o["id"]) if o.has_key?("id")
         
     | 
| 
       139 
     | 
    
         
            -
                  asm.name(o["name"]) if o.has_key?("name")
         
     | 
| 
       140 
     | 
    
         
            -
                  asm.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
         
     | 
| 
       141 
     | 
    
         
            -
                  asm.org_id(o["org_id"]) if o.has_key?("org_id")
         
     | 
| 
       142 
     | 
    
         
            -
                  asm.assemblies(o["assemblies"]) if o.has_key?("assemblies") #this will be an array? can hash store array?
         
     | 
| 
       143 
     | 
    
         
            -
                  asm.inputs(o["inputs"]) if o.has_key?("inputs")
         
     | 
| 
       144 
     | 
    
         
            -
                  asm.created_at(o["created_at"]) if o.has_key?("created_at")
         
     | 
| 
       145 
     | 
    
         
            -
                  asm
         
     | 
| 
       146 
     | 
    
         
            -
                end
         
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
                def self.from_hash(o)
         
     | 
| 
       149 
     | 
    
         
            -
                  asm = self.new(o)
         
     | 
| 
       150 
     | 
    
         
            -
                  asm.from_hash(o)
         
     | 
| 
       151 
     | 
    
         
            -
                  asm
         
     | 
| 
       152 
     | 
    
         
            -
                end
         
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
                def from_hash(o)
         
     | 
| 
       155 
     | 
    
         
            -
                  @id                = o[:id] if o.has_key?(:id)
         
     | 
| 
       156 
     | 
    
         
            -
                  @name              = o[:name] if o.has_key?(:name)
         
     | 
| 
       157 
     | 
    
         
            -
                  @accounts_id       = o[:accounts_id] if o.has_key?(:accounts_id)
         
     | 
| 
       158 
     | 
    
         
            -
                  @org_id            = o[:org_id] if o.has_key?(:org_id)
         
     | 
| 
       159 
     | 
    
         
            -
                  @assemblies        = o[:assemblies] if o.has_key?(:assemblies)
         
     | 
| 
       160 
     | 
    
         
            -
                  @inputs            = o[:inputs] if o.has_key?(:inputs)
         
     | 
| 
       161 
     | 
    
         
            -
                  @created_at        = o[:created_at] if o.has_key?(:created_at)
         
     | 
| 
       162 
     | 
    
         
            -
                  self
         
     | 
| 
       163 
     | 
    
         
            -
                end
         
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
                def self.create(params)
         
     | 
| 
       166 
     | 
    
         
            -
                  asm = from_hash(params)
         
     | 
| 
       167 
     | 
    
         
            -
                  asm.create
         
     | 
| 
       168 
     | 
    
         
            -
                end
         
     | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
       170 
     | 
    
         
            -
                # Create the node via the REST API
         
     | 
| 
       171 
     | 
    
         
            -
                def create
         
     | 
| 
       172 
     | 
    
         
            -
                  megam_rest.post_assemblies(to_hash)
         
     | 
| 
       173 
     | 
    
         
            -
                end
         
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
                # Load a account by email_p
         
     | 
| 
       176 
     | 
    
         
            -
                def self.show(o)
         
     | 
| 
       177 
     | 
    
         
            -
                  asm = self.new(o)
         
     | 
| 
       178 
     | 
    
         
            -
                  asm.megam_rest.get_one_assemblies(o[:assemblies_id])
         
     | 
| 
       179 
     | 
    
         
            -
                end
         
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
                def self.list(params)
         
     | 
| 
       182 
     | 
    
         
            -
                  asm = self.new(params)
         
     | 
| 
       183 
     | 
    
         
            -
                  asm.megam_rest.get_assemblies
         
     | 
| 
       184 
     | 
    
         
            -
                end
         
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
                def to_s
         
     | 
| 
       187 
     | 
    
         
            -
                  Megam::Stuff.styled_hash(to_hash)
         
     | 
| 
       188 
     | 
    
         
            -
                end
         
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
              end
         
     | 
| 
       191 
207 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: megam_api
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.5.beta5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan,
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2016-06- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2016-06-08 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: excon
         
     |