Sha256: 53a7ab409b77000c618db117174d9dba1dd7cc441970f81c2e44bb29dead9186

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require_relative '../rest/rest'

module GoodData
  class Invitation < GoodData::Rest::Object
    def initialize(json)
      @json = json
    end

    def contributor
      data = client.get @json['invitation']['meta']['contributor']
      client.create GoodData::AccountSettings, data
    end

    def created
      DateTime.parse(@json['invitation']['meta']['created'])
    end

    def email
      @json['invitation']['content']['email']
    end

    def first_name
      @json['invitation']['content']['firstname']
    end

    def phone
      @json['invitation']['content']['phone']
    end

    def profile
      data = client.get @json['invitation']['links']['profile']
      client.create GoodData::AccountSettings, data
    end

    def project
      data = client.get @json['invitation']['links']['project']
      client.create GoodData::Project, data
    end

    def project_name
      @json['invitation']['content']['projectname']
    end

    def role
      # TODO: Return object instead
      @json['invitation']['content']['role']
    end

    def status
      @json['invitation']['content']['status']
    end

    def summary
      @json['invitation']['content']['summary']
    end

    def title
      @json['invitation']['content']['title']
    end

    def updated
      DateTime.parse(@json['invitation']['meta']['updated'])
    end

    def uri
      @json['invitation']['links']['self']
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gooddata-0.6.24 lib/gooddata/models/invitation.rb
gooddata-0.6.23 lib/gooddata/models/invitation.rb
gooddata-0.6.22 lib/gooddata/models/invitation.rb