phoneburner 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phoneburner.rb +3 -2
- data/lib/phoneburner/client.rb +4 -2
- data/lib/phoneburner/member.rb +10 -0
- data/lib/phoneburner/model.rb +7 -6
- data/lib/phoneburner/request.rb +7 -1
- data/lib/phoneburner/response.rb +2 -1
- data/lib/phoneburner/version.rb +1 -1
- data/phoneburner.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbbb3200084bf2f88d4e0b1d5adc83239c529097
|
4
|
+
data.tar.gz: 1ff8c9165c462cd4f38fe3620900d38c2fb02af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 361e03930c94cf3cef78645f6dc31cf7e62e5019a74304c36233b61647496a421fff6217620d60fff1be2cfedf7a13606609e54790abd33646caa0fd2db18a2f
|
7
|
+
data.tar.gz: 664f656f1ab4d6af88a72edb9c0a10d802b15ead79cc0b0397fda2e6a55ce072ca88a723bd5a5d0b0adf9c7affbcf0395e7482a96ea30387e3d7115c7fc9d9e0
|
data/lib/phoneburner.rb
CHANGED
@@ -10,14 +10,15 @@ require "phoneburner/dialsession"
|
|
10
10
|
require "phoneburner/folder"
|
11
11
|
require "phoneburner/settings"
|
12
12
|
require "phoneburner/voicemail"
|
13
|
+
require "phoneburner/call"
|
13
14
|
|
14
15
|
|
15
16
|
require "rest-client"
|
16
17
|
|
17
18
|
module Phoneburner
|
18
19
|
|
19
|
-
def self.client(api_token)
|
20
|
-
Phoneburner::Client.new(api_token)
|
20
|
+
def self.client(api_token,opts={})
|
21
|
+
Phoneburner::Client.new(api_token,opts)
|
21
22
|
end
|
22
23
|
|
23
24
|
end
|
data/lib/phoneburner/client.rb
CHANGED
data/lib/phoneburner/member.rb
CHANGED
data/lib/phoneburner/model.rb
CHANGED
@@ -2,14 +2,14 @@ module Phoneburner
|
|
2
2
|
class Model
|
3
3
|
|
4
4
|
def initialize(client, attrs={})
|
5
|
-
@client = client
|
5
|
+
@client = client
|
6
6
|
attributes(attrs)
|
7
7
|
end
|
8
8
|
|
9
9
|
def attributes(attrs)
|
10
|
-
@attrs = Hash[attrs.map do |k, v|
|
10
|
+
@attrs = Hash[attrs.map do |k, v|
|
11
11
|
if v.is_a?(Hash)
|
12
|
-
[k.to_s, Phoneburner::Model.new(client,v)]
|
12
|
+
[k.to_s, Phoneburner::Model.new(@client,v)]
|
13
13
|
else
|
14
14
|
[k.to_s, v]
|
15
15
|
end
|
@@ -42,6 +42,7 @@ module Phoneburner
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def method_missing(symbol,*args)
|
45
|
+
@attrs ||= {}
|
45
46
|
if symbol.to_s.end_with?("=")
|
46
47
|
@attrs[symbol.to_s.gsub!(/=$/,'')] = args.first
|
47
48
|
else
|
@@ -49,8 +50,8 @@ module Phoneburner
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
|
-
def to_json
|
53
|
-
@attrs.to_json
|
53
|
+
def to_json(a=nil)
|
54
|
+
@attrs.to_json(a)
|
54
55
|
end
|
55
56
|
|
56
57
|
def is_new?
|
@@ -87,7 +88,7 @@ module Phoneburner
|
|
87
88
|
private
|
88
89
|
def update_attributes(attrs)
|
89
90
|
attrs.each do |k, v|
|
90
|
-
@attrs[k.to_s] = v.is_a?(Hash) ? Phoneburner::Model.new(client,v)
|
91
|
+
@attrs[k.to_s] = v.is_a?(Hash) ? Phoneburner::Model.new(client,v) : v
|
91
92
|
end
|
92
93
|
nil
|
93
94
|
end
|
data/lib/phoneburner/request.rb
CHANGED
@@ -5,7 +5,7 @@ module Phoneburner
|
|
5
5
|
@model = model
|
6
6
|
@client = client
|
7
7
|
@token = client.token
|
8
|
-
@url =
|
8
|
+
@url = client.url
|
9
9
|
@query_params = {}
|
10
10
|
end
|
11
11
|
|
@@ -46,6 +46,12 @@ module Phoneburner
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def create!(obj_or_hash_or_json)
|
50
|
+
Phoneburner::Response.new(self) do
|
51
|
+
RestClient.post "#{@url}#{@model.path}", as_json(obj_or_hash_or_json), {:Authorization => "Bearer #{@token}",:content_type => :json, :accept => :json}
|
52
|
+
end.result
|
53
|
+
end
|
54
|
+
|
49
55
|
def update(id,obj_or_hash_or_json)
|
50
56
|
Phoneburner::Response.new(self) do
|
51
57
|
RestClient.put "#{@url}#{@model.path}#{id}", as_json(obj_or_hash_or_json), {:Authorization => "Bearer #{@token}",:content_type => :json, :accept => :json}
|
data/lib/phoneburner/response.rb
CHANGED
@@ -66,7 +66,8 @@ module Phoneburner
|
|
66
66
|
parse()
|
67
67
|
return nil if @inner_results.nil?
|
68
68
|
if @inner_results.is_a?(Array)
|
69
|
-
|
69
|
+
puts "Array"
|
70
|
+
e = Enumerator.new do |y|
|
70
71
|
@inner_results.each do |ir|
|
71
72
|
obj = is_raw? ? ir : request.build(ir)
|
72
73
|
y.yield(obj)
|
data/lib/phoneburner/version.rb
CHANGED
data/phoneburner.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["dennis@rigpasolutions.com"]
|
11
11
|
spec.summary = %q{API for PhoneBurner.com}
|
12
12
|
spec.description = %q{API for PhoneBurner.com}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/dennis27/phoneburner"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phoneburner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Vaughn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -79,7 +79,7 @@ files:
|
|
79
79
|
- lib/phoneburner/version.rb
|
80
80
|
- lib/phoneburner/voicemail.rb
|
81
81
|
- phoneburner.gemspec
|
82
|
-
homepage:
|
82
|
+
homepage: https://github.com/dennis27/phoneburner
|
83
83
|
licenses:
|
84
84
|
- MIT
|
85
85
|
metadata: {}
|