google_r 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe GoogleR::Event do
4
+ before(:each) do
5
+ end
6
+
7
+ let(:event) { GoogleR::Event.new(nil) }
8
+
9
+ it "represents with valid-formatted times" do
10
+ time = Time.new(2012, 6, 4, 9, 34, 48, "-04:00")
11
+ event.start_time = time
12
+ format = event.to_google
13
+ expect(format).to include("2012-06-04T09:34:48-04:00")
14
+ end
15
+
16
+ it "parses events which take whole day" do
17
+ json = {
18
+ "kind" => "calendar#event",
19
+ "start" => {
20
+ "date" => "2012-03-04",
21
+ },
22
+ "end" => {
23
+ "date" => "2012-03-05",
24
+ },
25
+ "updated" => Time.now.to_s,
26
+ "created" => Time.now.to_s,
27
+ }
28
+
29
+ event = GoogleR::Event.from_json(json, double(:calendar => nil))
30
+ expect(event.start_time).to eq(Time.parse("2012-03-04"))
31
+ expect(event.end_time).to eq(Time.parse("2012-03-05"))
32
+ end
33
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe GoogleR::Contact do
4
+ before(:each) do
5
+ @single_group_path = "spec/fixtures/single_group.xml"
6
+ @parsed_xml = Nokogiri::XML.parse(File.read(@single_group_path))
7
+ @parsed_xml.remove_namespaces!
8
+ @group = GoogleR::Group.from_xml(@parsed_xml.root)
9
+ end
10
+
11
+ it "should load id and etag from xml" do
12
+ expect(@group.google_id).to eq("http://www.google.com/m8/feeds/groups/michal%40futuresimple.com/base/5e8cb5e00cc22016")
13
+ expect(@group.etag).to eq("\"Qnw-eTVSLit7I2A9WhVREUgNQQ0.\"")
14
+ end
15
+
16
+ it "should load content from xml" do
17
+ expect(@group.title).to eq("Grupa 52")
18
+ end
19
+
20
+ it "should load updated from xml" do
21
+ expect(@group.updated).to eq(Time.parse("2012-03-19T11:48:13.251Z"))
22
+ end
23
+
24
+ it "should load extended from xml" do
25
+ expect(@group.property.name).to eq("Grupa 55")
26
+ expect(@group.property.info).to eq("To jest grupa")
27
+ end
28
+
29
+ it "should generate valid xml" do
30
+ xml = @group.to_google
31
+ g = Nokogiri::XML.parse(xml).root
32
+
33
+ expect(g.name).to eq("entry")
34
+ expect(g.namespace.prefix).to eq("atom")
35
+
36
+ expect(g.search("id").size).to eq(1)
37
+ end
38
+
39
+ context "google api expectations" do
40
+ it "should send application/xml+atom content type for groups" do
41
+ headers = GoogleR::Group.api_headers
42
+ expect(headers).to have_key("Content-Type")
43
+ expect(headers["Content-Type"]).to eq("application/atom+xml")
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,7 @@
1
+ require "simplecov"
2
+
3
+ SimpleCov.start do
4
+ add_filter '/spec'
5
+ end
6
+
7
+ require "google_r"
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google_r
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Zendesk
8
+ - Przemek Owczarek
9
+ - Michal Bugno
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2021-02-22 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: simplecov
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: fuubar
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: nokogiri
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: yajl-ruby
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: faraday
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ description: Google API with Ruby
100
+ email:
101
+ - opensource@zendesk.com
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - ".github/workflows/ci.yml"
107
+ - ".github/workflows/gempush.yml"
108
+ - ".gitignore"
109
+ - ".rspec"
110
+ - CHANGELOG.md
111
+ - Gemfile
112
+ - LICENSE
113
+ - README.md
114
+ - Rakefile
115
+ - google_r.gemspec
116
+ - lib/google_r.rb
117
+ - lib/google_r/calendar.rb
118
+ - lib/google_r/contact.rb
119
+ - lib/google_r/event.rb
120
+ - lib/google_r/exceptions.rb
121
+ - lib/google_r/group.rb
122
+ - lib/google_r/token.rb
123
+ - lib/google_r/version.rb
124
+ - spec/fixtures/contact_list.xml
125
+ - spec/fixtures/no_contacts.xml
126
+ - spec/fixtures/single_contact.xml
127
+ - spec/fixtures/single_group.xml
128
+ - spec/google_api_spec.rb
129
+ - spec/google_contact_spec.rb
130
+ - spec/google_event_spec.rb
131
+ - spec/google_group_spec.rb
132
+ - spec/spec_helper.rb
133
+ homepage: https://github.com/zendesk/google_r
134
+ licenses:
135
+ - Apache-2.0
136
+ metadata: {}
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubygems_version: 3.0.3
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: Google API with Ruby
156
+ test_files: []