Class: Bitcodin::BitcodinAPI

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

Instance Method Summary collapse

Constructor Details

#initialize(apiKey) ⇒ BitcodinAPI

Returns a new instance of BitcodinAPI.


29
30
31
32
33
34
35
36
37
38
# File 'lib/bitcodin.rb', line 29

def initialize(apiKey)
  @apiKey  = apiKey
  @apiURL  = 'http://portal.bitcodin.com/api/'
  @headers = {
      :content_type => 'application/json',
      :bitcodin_api_version => 'v1',
      :bitcodin_api_key => @apiKey
  }
  @httpClient = HTTP.new(@apiKey, @headers)
end

Instance Method Details

#analyzeInput(id) ⇒ Object

An existing input will be analyzed again and a new thumbnail will be created.


53
54
55
56
# File 'lib/bitcodin.rb', line 53

def analyzeInput(id)
  url = @apiURL.concat('input/').concat(id.to_s).concat('/analyze')
  return @httpClient.sendRequest('patch', url)
end

#createEncodingProfile(config) ⇒ Object

Encoding Profiles


117
118
119
120
# File 'lib/bitcodin.rb', line 117

def createEncodingProfile(config)
  url = @apiURL.concat('encoding-profile/create')
  return @httpClient.sendRequest('post', url, config.values)
end

#createFTPOutput(config) ⇒ Object


90
91
92
93
# File 'lib/bitcodin.rb', line 90

def createFTPOutput(config)
  url = @apiURL.concat('output/create')
  return @httpClient.sendRequest('post', url, config.values)
end

#createGCSOutput(config) ⇒ Object


85
86
87
88
# File 'lib/bitcodin.rb', line 85

def createGCSOutput(config)
  url = @apiURL.concat('output/create')
  return @httpClient.sendRequest('post', url, config.values)
end

#createInput(inputConfig) ⇒ Object

Create a new Input, which will be analyzed and used for transcoding jobs.


47
48
49
50
# File 'lib/bitcodin.rb', line 47

def createInput(inputConfig)
  url = @apiURL.concat('input/create')
  return @httpClient.sendRequest('post', url, inputConfig.values)
end

#createJob(config) ⇒ Object

Jobs


144
145
146
147
# File 'lib/bitcodin.rb', line 144

def createJob(config)
  url = @apiURL.concat('job/create')
  return @httpClient.sendRequest('post', url, config.values)
end

#createS3Output(config) ⇒ Object

Output


80
81
82
83
# File 'lib/bitcodin.rb', line 80

def createS3Output(config)
  url = @apiURL.concat('output/create')
  return @httpClient.sendRequest('post', url, config.values)
end

#createTransferJob(config) ⇒ Object


169
170
171
172
# File 'lib/bitcodin.rb', line 169

def createTransferJob(config)
  url = @apiURL.concat('job/transfer')
  return @httpClient.sendRequest('post', url, config.values)
end

#deleteEncodingProfile(id) ⇒ Object


137
138
139
140
# File 'lib/bitcodin.rb', line 137

def deleteEncodingProfile(id)
  url = @apiURL.concat('encoding-profile/').concat(id.to_s)
  return @httpClient.sendRequest('delete', url)
end

#deleteInput(id) ⇒ Object


73
74
75
76
# File 'lib/bitcodin.rb', line 73

def deleteInput(id)
  url = @apiURL.concat('input/').concat(id.to_s)
  return @httpClient.sendRequest('delete', url)
end

#deleteJob(id) ⇒ Object


179
180
181
182
# File 'lib/bitcodin.rb', line 179

def deleteJob(id)
  url = @apiURL.concat('job/').concat(id.to_s)
  return @httpClient.sendRequest('delete', url)
end

#deleteOutput(id) ⇒ Object


110
111
112
113
# File 'lib/bitcodin.rb', line 110

def deleteOutput(id)
  url = @apiURL.concat('output/').concat(id.to_s)
  return @httpClient.sendRequest('delete', url)
end

#getCurrentJobStatus(id) ⇒ Object


164
165
166
167
# File 'lib/bitcodin.rb', line 164

def getCurrentJobStatus(id)
  url = @apiURL.concat('job/').concat(id.to_s).concat('/status')
  return @httpClient.sendRequest('get', url)
end

#getCurrentOutputStatusObject

Statistics


186
187
188
189
# File 'lib/bitcodin.rb', line 186

def getCurrentOutputStatus
  url = @apiURL.concat('statistics')
  return @httpClient.sendRequest('get', url)
end

#getEncodingProfile(id) ⇒ Object


132
133
134
135
# File 'lib/bitcodin.rb', line 132

def getEncodingProfile(id)
  url = @apiURL.concat('encoding-profile/').concat(id.to_s)
  return @httpClient.sendRequest('get', url)
end

#getInputDetails(id) ⇒ Object


68
69
70
71
# File 'lib/bitcodin.rb', line 68

def getInputDetails(id)
  url = @apiURL.concat('input/').concat(id.to_s)
  return @httpClient.sendRequest('get', url)
end

#getInvoiceInfosObject


204
205
206
207
# File 'lib/bitcodin.rb', line 204

def getInvoiceInfos
  url = @apiURL.concat('payment/invoiceinfo')
  return @httpClient.sendRequest('get', url)
end

#getJobDetails(id) ⇒ Object


159
160
161
162
# File 'lib/bitcodin.rb', line 159

def getJobDetails(id)
  url = @apiURL.concat('job/').concat(id.to_s)
  return @httpClient.sendRequest('get', url)
end

#getJobStatistics(from, to) ⇒ Object


191
192
193
194
# File 'lib/bitcodin.rb', line 191

def getJobStatistics(from, to)
  url = @apiURL.concat('statistics/jobs/').concat(from.to_s).concat('/').concat(to.to_s)
  return @httpClient.sendRequest('get', url)
end

#getKeyObject


40
41
42
# File 'lib/bitcodin.rb', line 40

def getKey
  return @apiKey
end

#getListOfAllBills(page = nil) ⇒ Object


226
227
228
229
230
231
232
233
234
# File 'lib/bitcodin.rb', line 226

def getListOfAllBills(page = nil)
  url = @apiURL.concat('payment/bills')
  if page.nil?
    return @httpClient.sendRequest('get', url)
  else
    url = url.concat('/').concat(page.to_s)
    return @httpClient.sendRequest('get', url)
  end
end

#getListOfAllDeposits(page = nil) ⇒ Object


216
217
218
219
220
221
222
223
224
# File 'lib/bitcodin.rb', line 216

def getListOfAllDeposits(page = nil)
  url = @apiURL.concat('payment/deposits')
  if page.nil?
    return @httpClient.sendRequest('get', url)
  else
    url = url.concat('/').concat(page.to_s)
    return @httpClient.sendRequest('get', url)
  end
end

#getOutputDetails(id) ⇒ Object


105
106
107
108
# File 'lib/bitcodin.rb', line 105

def getOutputDetails(id)
  url = @apiURL.concat('output/').concat(id.to_s)
  return @httpClient.sendRequest('get', url)
end

#getWalletInformationObject

Wallet


211
212
213
214
# File 'lib/bitcodin.rb', line 211

def getWalletInformation
  url = @apiURL.concat('payment/user')
  return @httpClient.sendRequest('get', url)
end

#listAllJobs(page = nil) ⇒ Object


149
150
151
152
153
154
155
156
157
# File 'lib/bitcodin.rb', line 149

def listAllJobs(page = nil)
  url = @apiURL.concat('jobs')
  if page.nil?
    return @httpClient.sendRequest('get', url)
  else
    url = url.concat('/').concat(page.to_s)
    return @httpClient.sendRequest('get', url)
  end
end

#listEncodingProfiles(page = nil) ⇒ Object


122
123
124
125
126
127
128
129
130
# File 'lib/bitcodin.rb', line 122

def listEncodingProfiles(page = nil)
  url = @apiURL.concat('encoding-profiles')
  if page.nil?
    return @httpClient.sendRequest('get', url)
  else
    url = url.concat('/').concat(page.to_s)
    return @httpClient.sendRequest('get', url)
  end
end

#listInput(page = nil) ⇒ Object


58
59
60
61
62
63
64
65
66
# File 'lib/bitcodin.rb', line 58

def listInput(page = nil)
  url = @apiURL.concat('inputs')
  if page.nil?
    return @httpClient.sendRequest('get', url)
  else
    url = url.concat('/').concat(page.to_s)
    return @httpClient.sendRequest('get', url)
  end
end

#listOutputs(page = nil) ⇒ Object


95
96
97
98
99
100
101
102
103
# File 'lib/bitcodin.rb', line 95

def listOutputs(page = nil)
  url = @apiURL.concat('outputs')
  if page.nil?
    return @httpClient.sendRequest('get', url)
  else
    url = url.concat('/').concat(page.to_s)
    return @httpClient.sendRequest('get', url)
  end
end

#listTransferJob(id) ⇒ Object


174
175
176
177
# File 'lib/bitcodin.rb', line 174

def listTransferJob(id)
  url = @apiURL.concat('job/').concat(id.to_s).concat('/transfers')
  return @httpClient.sendRequest('get', url)
end

#updateInvoiceInfos(infos) ⇒ Object

Paymant


198
199
200
201
202
# File 'lib/bitcodin.rb', line 198

def updateInvoiceInfos(infos)
  url = @apiURL.concat('payment/invoiceinfo')
  puts infos.values
  return @httpClient.sendRequest('post', url, infos.values)
end