Sha256: 188e806eefc529b076ea827339b7e3b079e580a9d7429f8167b3b01f6fcc44d5

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 KB

Contents

# Copyright:: Copyright (c) 2012-2013 Megam Systems, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
module Megam
  class GogsTokens

    # Transform the ruby obj ->  to a Hash
    def self.to_hash(response)
  
       index_hash = response.body
      {:status => response.status, :body => index_hash }
    end



    def self.list(username, password)

      megams = Megam::Gogs.new
      res = megams.get_tokens(username, password)
      hash = {}
      puts res
      puts res.status
      if res.status != 200
        hash = self.error(res)
      else
        hash = self.to_hash(res)
      end
      hash
    end

    def self.error(response)

      {:status => response.status, :body => ""}
    end

    def to_s
      Megam::Stuff.styled_hash(to_hash)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
megam_gogs-0.8.0 lib/megam/core/gogs_tokens.rb
megam_gogs-0.7.0 lib/megam/core/gogs_tokens.rb
megam_gogs-0.6.0 lib/megam/core/gogs_tokens.rb
megam_gogs-0.5.0 lib/megam/core/gogs_tokens.rb
megam_gogs-0.4.0 lib/megam/core/gogs_tokens.rb