Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements SystemDateAndTime schema as well as Get and Set operations with tests #71

Merged
merged 20 commits into from
Jul 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions lib/devices/set_system_date_and_time.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
end

def request_body(%SystemDateAndTime{} = system_date_time) do
request_body([config: system_date_time, set_time?: false])
end

#def request_body(%SystemDateAndTime{} = system_date_time, opts) do
def request_body([config: %SystemDateAndTime{} = system_date_time] = opts) do
paoloo marked this conversation as resolved.
Show resolved Hide resolved
IO.inspect(opts)
set_time? = Keyword.get(opts, :set_time?, false)
element(:"s:Body", [
element(:"tds:SetSystemDateAndTime", [
element(:"tds:DateAndTime", system_date_time.date_time_type ),
Expand All @@ -23,7 +30,13 @@
element(:"tt:TZ", system_date_time.time_zone.tz )
]
),
List.flatten([utc_date_time_element(system_date_time, set_time?)])
])
])
end

def utc_date_time_element(system_date_time, false) do [] end

Check warning on line 38 in lib/devices/set_system_date_and_time.ex

View workflow job for this annotation

GitHub Actions / Build and test

variable "system_date_time" is unused (if the variable is not meant to be used, prefix it with an underscore)
paoloo marked this conversation as resolved.
Show resolved Hide resolved
def utc_date_time_element(system_date_time, true) do
element(
:"tds:UTCDateTime",
[
Expand All @@ -39,9 +52,6 @@
])
]
)

])
])
end

def response(xml_response_body) do
Expand Down
Loading