Class: ProcessOut::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/processout/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Project

Initializes the Project object Params:

client

ProcessOut client instance



41
42
43
44
45
46
47
48
49
50
# File 'lib/processout/project.rb', line 41

def initialize(client)
  @client = client

  @id = ""
  @name = ""
  @logo_url = ""
  @email = ""
  @created_at = ""
  
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



14
15
16
# File 'lib/processout/project.rb', line 14

def created_at
  @created_at
end

#emailObject

Returns the value of attribute email.



13
14
15
# File 'lib/processout/project.rb', line 13

def email
  @email
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/processout/project.rb', line 10

def id
  @id
end

#logo_urlObject

Returns the value of attribute logo_url.



12
13
14
# File 'lib/processout/project.rb', line 12

def logo_url
  @logo_url
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/processout/project.rb', line 11

def name
  @name
end

Instance Method Details

#fill_with_data(data) ⇒ Object

Fills the object with data coming from the API Params:

data

Hash of data coming from the API



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/processout/project.rb', line 55

def fill_with_data(data)
  if data.include? "id"
    @id = data["id"]
  end
  if data.include? "name"
    @name = data["name"]
  end
  if data.include? "logo_url"
    @logo_url = data["logo_url"]
  end
  if data.include? "email"
    @email = data["email"]
  end
  if data.include? "created_at"
    @created_at = data["created_at"]
  end
  
  self
end

#gateway_configurations(options = nil) ⇒ Object

Get all the gateway configurations of the project Params:

options

Hash of options



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/processout/project.rb', line 78

def gateway_configurations(options = nil)
  request = Request.new(@client)
  path    = "/projects/" + CGI.escape(@id) + "/gateway-configurations"
  data    = {

  }

  response = Response.new(request.get(path, data, options))
  return_values = Array.new
  
  a    = Array.new
  body = response.body
  for v in body['gateway_configurations']
    tmp = GatewayConfiguration(@client)
    tmp.fill_with_data(v)
    a.push(tmp)
  end

  return_values.push(a)
  

  
  return_values[0]
end